home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / tex-k / gsftopkk.shar.gz / gsftopkk.shar
Internet Message Format  |  1995-02-11  |  100KB

  1. From: interran@uluru.Stanford.EDU (John Interrante)
  2. To: kb@cs.umb.edu
  3. Subject: kpathsea 2.52 and gsftopk
  4. Date: Fri, 6 Jan 95 01:42:21 PST
  5.  
  6. --- Makefile.in.save    Wed Jan  4 16:13:31 1995
  7. +++ Makefile.in    Thu Jan  5 15:46:54 1995
  8. @@ -2,5 +2,5 @@
  9.  
  10.  # Package subdirectories, the library, and all subdirectories.
  11. -programs = dviljk dvipsk web2c xdvik
  12. +programs = dviljk dvipsk gsftopk web2c xdvik
  13.  kpathsea_dir = kpathsea
  14.  all_dirs = $(programs) $(kpathsea_dir)
  15. --- configure.in.save    Wed Jan  4 09:49:39 1995
  16. +++ configure.in    Thu Jan  5 15:37:59 1995
  17. @@ -25,5 +25,5 @@
  18.  AC_PROG_INSTALL
  19.  
  20. -AC_CONFIG_SUBDIRS(kpathsea dviljk dvipsk web2c xdvik)
  21. +AC_CONFIG_SUBDIRS(kpathsea dviljk dvipsk gsftopk web2c xdvik)
  22.  
  23.  AC_OUTPUT(Makefile)
  24.  
  25. Finally, here're the contents of my gsftopk subdirectory.  I've got
  26. dvipsk, gsftpk, web2c, and xdvik all lying together in the same
  27. top-level directory called kpathsea-2.52.
  28.  
  29.         John
  30.  
  31. #!/bin/sh
  32. # This is a shell archive (produced by GNU sharutils 4.1).
  33. # To extract the files from this archive, save it to some FILE, remove
  34. # everything before the `!/bin/sh' line above, then type `sh FILE'.
  35. #
  36. # Made on 1995-01-06 01:22 PST by <interran@uluru>.
  37. # Source directory was `/home/uluru/src/TeX/kpathsea-2.52'.
  38. #
  39. # Existing files will *not* be overwritten unless `-c' is specified.
  40. #
  41. # This shar contains:
  42. # length mode       name
  43. # ------ ---------- ------------------------------------------
  44. #   1146 -rw-r--r-- gsftopk/Makefile.in
  45. #    694 -rw-r--r-- gsftopk/acconfig.h
  46. #   2526 -rw-r--r-- gsftopk/c-auto.h.in
  47. #  53177 -rwxr-xr-x gsftopk/configure
  48. #    269 -rw-r--r-- gsftopk/configure.in
  49. #   4386 -rw-r--r-- gsftopk/gsftopk.1
  50. #  23315 -rw-r--r-- gsftopk/gsftopk.c
  51. #   5319 -rw-r--r-- gsftopk/render.ps
  52. #
  53. touch -am 1231235999 $$.touch >/dev/null 2>&1
  54. if test ! -f 1231235999 && test -f $$.touch; then
  55.   shar_touch=touch
  56. else
  57.   shar_touch=:
  58.   echo
  59.   echo 'WARNING: not restoring timestamps.  Consider getting and'
  60.   echo "installing GNU \`touch', distributed in GNU File Utilities..."
  61.   echo
  62. fi
  63. rm -f 1231235999 $$.touch
  64. #
  65. # ============= gsftopk/Makefile.in ==============
  66. if test ! -d 'gsftopk'; then
  67.   echo 'x - creating directory gsftopk'
  68.   mkdir 'gsftopk'
  69. fi
  70. if test -f 'gsftopk/Makefile.in' && test X"$1" != X"-c"; then
  71.   echo 'x - skipping gsftopk/Makefile.in (file already exists)'
  72. else
  73.   echo 'x - extracting gsftopk/Makefile.in (text)'
  74.   sed 's/^X//' << 'SHAR_EOF' > 'gsftopk/Makefile.in' &&
  75. # Makefile for gsftopkk --kb@cs.umb.edu.
  76. version = 1.7e2
  77. X
  78. ac_include ../make/paths.make
  79. X
  80. # (Optional) The fully-qualified path of Ghostscript.
  81. # GSPATH=-DGS=\"/usr/local/gnu/bin/gs\"
  82. GSPATH=-DGS=\"/usr/local/bin/gs\"
  83. X
  84. # See INSTALL for compilation options.
  85. DEFS = $(GSPATH) $(XDEFS)
  86. X
  87. ac_include ../make/common.make
  88. ac_include ../make/programs.make
  89. X
  90. objects = gsftopk.o
  91. X
  92. program = gsftopk
  93. X
  94. default all: $(program)
  95. X
  96. $(program): $(kpathsea) $(objects)
  97. X    $(CC) $(LDFLAGS) -o $@ $(objects) $(LOADLIBES)
  98. X
  99. ac_include ../make/tkpathsea.make
  100. X
  101. install: install-exec install-data
  102. uninstall: uninstall-exec uninstall-data
  103. X
  104. install-exec: $(program)
  105. X    $(SHELL) $(top_srcdir)/../mkdirchain $(bindir)
  106. X    $(INSTALL_PROGRAM) $(program) $(bindir)/$(program)
  107. uninstall-exec:
  108. X    rm -f $(bindir)/$(program)
  109. X
  110. install-data:
  111. X    $(SHELL) $(top_srcdir)/../mkdirchain $(mandir) $(psheaderdir)
  112. X    $(INSTALL_DATA) $(srcdir)/gsftopk.1 $(mandir)/gsftopk.$(manext)
  113. X    $(INSTALL_DATA) $(srcdir)/render.ps $(psheaderdir)/render.ps
  114. uninstall-data:
  115. X    rm -f $(mandir)/gsftopk.$(manext)
  116. X    rm -f $(psheaderdir)/render.ps
  117. X
  118. ac_include ../make/config.make
  119. X
  120. info dvi check:
  121. X
  122. ac_include ../make/misc.make
  123. SHAR_EOF
  124.   $shar_touch -am 0105144695 'gsftopk/Makefile.in' &&
  125.   chmod 0644 'gsftopk/Makefile.in' ||
  126.   echo 'restore of gsftopk/Makefile.in failed'
  127.   shar_count="`wc -c < 'gsftopk/Makefile.in'`"
  128.   test 1146 -eq "$shar_count" ||
  129.     echo "gsftopk/Makefile.in: original size 1146, current size $shar_count"
  130. fi
  131. # ============= gsftopk/acconfig.h ==============
  132. if test -f 'gsftopk/acconfig.h' && test X"$1" != X"-c"; then
  133.   echo 'x - skipping gsftopk/acconfig.h (file already exists)'
  134. else
  135.   echo 'x - extracting gsftopk/acconfig.h (text)'
  136.   sed 's/^X//' << 'SHAR_EOF' > 'gsftopk/acconfig.h' &&
  137. /* acconfig.h -- used by autoheader when generating c-auto.h.in.  */
  138. X
  139. /* Define if your putenv doesn't waste space when the same environment
  140. X   variable is assigned more than once, with different (malloced)
  141. X   values.  This is true only on NetBSD/FreeBSD, as far as I know. See
  142. X   xputenv.c.  */
  143. #undef SMART_PUTENV
  144. X
  145. /* Define if you are using GNU libc or otherwise have global variables
  146. X   `program_invocation_name' and `program_invocation_short_name'.  */
  147. #undef HAVE_PROGRAM_INVOCATION_NAME
  148. X
  149. /* Define if you get clashes concerning wchar_t, between X's include
  150. X   files and system includes.  */
  151. #undef FOIL_X_WCHAR_T
  152. X
  153. /* Define if you have SIGIO, F_SETOWN, and FASYNC.  */
  154. #undef HAVE_SIGIO
  155. SHAR_EOF
  156.   $shar_touch -am 0105144695 'gsftopk/acconfig.h' &&
  157.   chmod 0644 'gsftopk/acconfig.h' ||
  158.   echo 'restore of gsftopk/acconfig.h failed'
  159.   shar_count="`wc -c < 'gsftopk/acconfig.h'`"
  160.   test 694 -eq "$shar_count" ||
  161.     echo "gsftopk/acconfig.h: original size 694, current size $shar_count"
  162. fi
  163. # ============= gsftopk/c-auto.h.in ==============
  164. if test -f 'gsftopk/c-auto.h.in' && test X"$1" != X"-c"; then
  165.   echo 'x - skipping gsftopk/c-auto.h.in (file already exists)'
  166. else
  167.   echo 'x - extracting gsftopk/c-auto.h.in (text)'
  168.   sed 's/^X//' << 'SHAR_EOF' > 'gsftopk/c-auto.h.in' &&
  169. /* c-auto.h.in.  Generated automatically from configure.in by autoheader.  */
  170. X
  171. /* Define if the closedir function returns void instead of int.  */
  172. #undef CLOSEDIR_VOID
  173. X
  174. /* Define to empty if the keyword does not work.  */
  175. #undef const
  176. X
  177. /* Define if you don't have vprintf but do have _doprnt.  */
  178. #undef HAVE_DOPRNT
  179. X
  180. /* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
  181. #undef HAVE_SYS_WAIT_H
  182. X
  183. /* Define if you have <vfork.h>.  */
  184. #undef HAVE_VFORK_H
  185. X
  186. /* Define if you have the vprintf function.  */
  187. #undef HAVE_VPRINTF
  188. X
  189. /* Define to `int' if <sys/types.h> doesn't define.  */
  190. #undef pid_t
  191. X
  192. /* Define if you need to in order for stat and other things to work.  */
  193. #undef _POSIX_SOURCE
  194. X
  195. /* Define as the return type of signal handlers (int or void).  */
  196. #undef RETSIGTYPE
  197. X
  198. /* Define if you have the ANSI C header files.  */
  199. #undef STDC_HEADERS
  200. X
  201. /* Define vfork as fork if vfork does not work.  */
  202. #undef vfork
  203. X
  204. /* Define if your putenv doesn't waste space when the same environment
  205. X   variable is assigned more than once, with different (malloced)
  206. X   values.  This is true only on NetBSD/FreeBSD, as far as I know. See
  207. X   xputenv.c.  */
  208. #undef SMART_PUTENV
  209. X
  210. /* Define if you are using GNU libc or otherwise have global variables
  211. X   `program_invocation_name' and `program_invocation_short_name'.  */
  212. #undef HAVE_PROGRAM_INVOCATION_NAME
  213. X
  214. /* Define if you have the basename function.  */
  215. #undef HAVE_BASENAME
  216. X
  217. /* Define if you have the bcopy function.  */
  218. #undef HAVE_BCOPY
  219. X
  220. /* Define if you have the memmove function.  */
  221. #undef HAVE_MEMMOVE
  222. X
  223. /* Define if you have the putenv function.  */
  224. #undef HAVE_PUTENV
  225. X
  226. /* Define if you have the <assert.h> header file.  */
  227. #undef HAVE_ASSERT_H
  228. X
  229. /* Define if you have the <dirent.h> header file.  */
  230. #undef HAVE_DIRENT_H
  231. X
  232. /* Define if you have the <float.h> header file.  */
  233. #undef HAVE_FLOAT_H
  234. X
  235. /* Define if you have the <limits.h> header file.  */
  236. #undef HAVE_LIMITS_H
  237. X
  238. /* Define if you have the <memory.h> header file.  */
  239. #undef HAVE_MEMORY_H
  240. X
  241. /* Define if you have the <ndir.h> header file.  */
  242. #undef HAVE_NDIR_H
  243. X
  244. /* Define if you have the <pwd.h> header file.  */
  245. #undef HAVE_PWD_H
  246. X
  247. /* Define if you have the <stdlib.h> header file.  */
  248. #undef HAVE_STDLIB_H
  249. X
  250. /* Define if you have the <string.h> header file.  */
  251. #undef HAVE_STRING_H
  252. X
  253. /* Define if you have the <sys/dir.h> header file.  */
  254. #undef HAVE_SYS_DIR_H
  255. X
  256. /* Define if you have the <sys/ndir.h> header file.  */
  257. #undef HAVE_SYS_NDIR_H
  258. X
  259. /* Define if you have the <unistd.h> header file.  */
  260. #undef HAVE_UNISTD_H
  261. SHAR_EOF
  262.   $shar_touch -am 0105144595 'gsftopk/c-auto.h.in' &&
  263.   chmod 0644 'gsftopk/c-auto.h.in' ||
  264.   echo 'restore of gsftopk/c-auto.h.in failed'
  265.   shar_count="`wc -c < 'gsftopk/c-auto.h.in'`"
  266.   test 2526 -eq "$shar_count" ||
  267.     echo "gsftopk/c-auto.h.in: original size 2526, current size $shar_count"
  268. fi
  269. # ============= gsftopk/configure ==============
  270. if test -f 'gsftopk/configure' && test X"$1" != X"-c"; then
  271.   echo 'x - skipping gsftopk/configure (file already exists)'
  272. else
  273.   echo 'x - extracting gsftopk/configure (text)'
  274.   sed 's/^X//' << 'SHAR_EOF' > 'gsftopk/configure' &&
  275. #!/bin/sh
  276. X
  277. # Guess values for system-dependent variables and create Makefiles.
  278. # Generated automatically using autoconf version 2.1 
  279. # Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
  280. #
  281. # This configure script is free software; the Free Software Foundation
  282. # gives unlimited permission to copy, distribute and modify it.
  283. X
  284. # Defaults:
  285. ac_help=
  286. ac_default_prefix=/usr/local
  287. # Any additions from configure.in:
  288. X
  289. # Initialize some variables set by options.
  290. # The variables have the same names as the options, with
  291. # dashes changed to underlines.
  292. build=NONE
  293. cache_file=./config.cache
  294. exec_prefix=NONE
  295. host=NONE
  296. no_create=
  297. nonopt=NONE
  298. no_recursion=
  299. prefix=NONE
  300. program_prefix=NONE
  301. program_suffix=NONE
  302. program_transform_name=s,x,x,
  303. silent=
  304. site=
  305. srcdir=
  306. target=NONE
  307. verbose=
  308. x_includes=NONE
  309. x_libraries=NONE
  310. X
  311. # Initialize some other variables.
  312. subdirs=
  313. X
  314. ac_prev=
  315. for ac_option
  316. do
  317. X
  318. X  # If the previous option needs an argument, assign it.
  319. X  if test -n "$ac_prev"; then
  320. X    eval "$ac_prev=\$ac_option"
  321. X    ac_prev=
  322. X    continue
  323. X  fi
  324. X
  325. X  case "$ac_option" in
  326. X  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  327. X  *) ac_optarg= ;;
  328. X  esac
  329. X
  330. X  # Accept the important Cygnus configure options, so we can diagnose typos.
  331. X
  332. X  case "$ac_option" in
  333. X
  334. X  -build | --build | --buil | --bui | --bu | --b)
  335. X    ac_prev=build ;;
  336. X  -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
  337. X    build="$ac_optarg" ;;
  338. X
  339. X  -cache-file | --cache-file | --cache-fil | --cache-fi \
  340. X  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
  341. X    ac_prev=cache_file ;;
  342. X  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
  343. X  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
  344. X    cache_file="$ac_optarg" ;;
  345. X
  346. X  -disable-* | --disable-*)
  347. X    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
  348. X    # Reject names that are not valid shell variable names.
  349. X    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
  350. X      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
  351. X    fi
  352. X    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
  353. X    eval "enable_${ac_feature}=no" ;;
  354. X
  355. X  -enable-* | --enable-*)
  356. X    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
  357. X    # Reject names that are not valid shell variable names.
  358. X    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
  359. X      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
  360. X    fi
  361. X    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
  362. X    case "$ac_option" in
  363. X      *=*) ;;
  364. X      *) ac_optarg=yes ;;
  365. X    esac
  366. X    eval "enable_${ac_feature}='$ac_optarg'" ;;
  367. X
  368. X  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
  369. X  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
  370. X  | --exec | --exe | --ex)
  371. X    ac_prev=exec_prefix ;;
  372. X  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
  373. X  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
  374. X  | --exec=* | --exe=* | --ex=*)
  375. X    exec_prefix="$ac_optarg" ;;
  376. X
  377. X  -gas | --gas | --ga | --g)
  378. X    # Obsolete; use --with-gas.
  379. X    with_gas=yes ;;
  380. X
  381. X  -help | --help | --hel | --he)
  382. X    # Omit some internal or obsolete options to make the list less imposing.
  383. X    # This message is too long to be a string in the A/UX 3.1 sh.
  384. X    cat << EOF
  385. Usage: configure [options] [host]
  386. Options: [defaults in brackets after descriptions]
  387. Configuration:
  388. X  --cache-file=FILE       cache test results in FILE
  389. X  --help                  print this message
  390. X  --no-create             do not create output files
  391. X  --quiet, --silent       do not print \`checking...' messages
  392. X  --version               print the version of autoconf that created configure
  393. Directory and file names:
  394. X  --prefix=PREFIX         install architecture-independent files in PREFIX
  395. X                          [$ac_default_prefix]
  396. X  --exec-prefix=PREFIX    install architecture-dependent files in PREFIX
  397. X                          [same as prefix]
  398. X  --srcdir=DIR            find the sources in DIR [configure dir or ..]
  399. X  --program-prefix=PREFIX prepend PREFIX to installed program names
  400. X  --program-suffix=SUFFIX append SUFFIX to installed program names
  401. X  --program-transform-name=PROGRAM run sed PROGRAM on installed program names
  402. Host type:
  403. X  --build=BUILD           configure for building on BUILD [BUILD=HOST]
  404. X  --host=HOST             configure for HOST [guessed]
  405. X  --target=TARGET         configure for TARGET [TARGET=HOST]
  406. Features and packages:
  407. X  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  408. X  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  409. X  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  410. X  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  411. X  --x-includes=DIR        X include files are in DIR
  412. X  --x-libraries=DIR       X library files are in DIR
  413. --enable and --with options recognized:$ac_help
  414. EOF
  415. X    exit 0 ;;
  416. X
  417. X  -host | --host | --hos | --ho)
  418. X    ac_prev=host ;;
  419. X  -host=* | --host=* | --hos=* | --ho=*)
  420. X    host="$ac_optarg" ;;
  421. X
  422. X  -nfp | --nfp | --nf)
  423. X    # Obsolete; use --without-fp.
  424. X    with_fp=no ;;
  425. X
  426. X  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
  427. X  | --no-cr | --no-c)
  428. X    no_create=yes ;;
  429. X
  430. X  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
  431. X  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
  432. X    no_recursion=yes ;;
  433. X
  434. X  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  435. X    ac_prev=prefix ;;
  436. X  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  437. X    prefix="$ac_optarg" ;;
  438. X
  439. X  -program-prefix | --program-prefix | --program-prefi | --program-pref \
  440. X  | --program-pre | --program-pr | --program-p)
  441. X    ac_prev=program_prefix ;;
  442. X  -program-prefix=* | --program-prefix=* | --program-prefi=* \
  443. X  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
  444. X    program_prefix="$ac_optarg" ;;
  445. X
  446. X  -program-suffix | --program-suffix | --program-suffi | --program-suff \
  447. X  | --program-suf | --program-su | --program-s)
  448. X    ac_prev=program_suffix ;;
  449. X  -program-suffix=* | --program-suffix=* | --program-suffi=* \
  450. X  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
  451. X    program_suffix="$ac_optarg" ;;
  452. X
  453. X  -program-transform-name | --program-transform-name \
  454. X  | --program-transform-nam | --program-transform-na \
  455. X  | --program-transform-n | --program-transform- \
  456. X  | --program-transform | --program-transfor \
  457. X  | --program-transfo | --program-transf \
  458. X  | --program-trans | --program-tran \
  459. X  | --progr-tra | --program-tr | --program-t)
  460. X    ac_prev=program_transform_name ;;
  461. X  -program-transform-name=* | --program-transform-name=* \
  462. X  | --program-transform-nam=* | --program-transform-na=* \
  463. X  | --program-transform-n=* | --program-transform-=* \
  464. X  | --program-transform=* | --program-transfor=* \
  465. X  | --program-transfo=* | --program-transf=* \
  466. X  | --program-trans=* | --program-tran=* \
  467. X  | --progr-tra=* | --program-tr=* | --program-t=*)
  468. X    program_transform_name="$ac_optarg" ;;
  469. X
  470. X  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
  471. X  | -silent | --silent | --silen | --sile | --sil)
  472. X    silent=yes ;;
  473. X
  474. X  -site | --site | --sit)
  475. X    ac_prev=site ;;
  476. X  -site=* | --site=* | --sit=*)
  477. X    site="$ac_optarg" ;;
  478. X
  479. X  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
  480. X    ac_prev=srcdir ;;
  481. X  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
  482. X    srcdir="$ac_optarg" ;;
  483. X
  484. X  -target | --target | --targe | --targ | --tar | --ta | --t)
  485. X    ac_prev=target ;;
  486. X  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
  487. X    target="$ac_optarg" ;;
  488. X
  489. X  -v | -verbose | --verbose | --verbos | --verbo | --verb)
  490. X    verbose=yes ;;
  491. X
  492. X  -version | --version | --versio | --versi | --vers)
  493. X    echo "configure generated by autoconf version 2.1"
  494. X    exit 0 ;;
  495. X
  496. X  -with-* | --with-*)
  497. X    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
  498. X    # Reject names that are not valid shell variable names.
  499. X    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
  500. X      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
  501. X    fi
  502. X    ac_package=`echo $ac_package| sed 's/-/_/g'`
  503. X    case "$ac_option" in
  504. X      *=*) ;;
  505. X      *) ac_optarg=yes ;;
  506. X    esac
  507. X    eval "with_${ac_package}='$ac_optarg'" ;;
  508. X
  509. X  -without-* | --without-*)
  510. X    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
  511. X    # Reject names that are not valid shell variable names.
  512. X    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
  513. X      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
  514. X    fi
  515. X    ac_package=`echo $ac_package| sed 's/-/_/g'`
  516. X    eval "with_${ac_package}=no" ;;
  517. X
  518. X  --x)
  519. X    # Obsolete; use --with-x.
  520. X    with_x=yes ;;
  521. X
  522. X  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
  523. X  | --x-incl | --x-inc | --x-in | --x-i)
  524. X    ac_prev=x_includes ;;
  525. X  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
  526. X  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
  527. X    x_includes="$ac_optarg" ;;
  528. X
  529. X  -x-libraries | --x-libraries | --x-librarie | --x-librari \
  530. X  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
  531. X    ac_prev=x_libraries ;;
  532. X  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
  533. X  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
  534. X    x_libraries="$ac_optarg" ;;
  535. X
  536. X  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
  537. X    ;;
  538. X
  539. X  *) 
  540. X    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
  541. X      echo "configure: warning: $ac_option: invalid host type" 1>&2
  542. X    fi
  543. X    if test "x$nonopt" != xNONE; then
  544. X      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
  545. X    fi
  546. X    nonopt="$ac_option"
  547. X    ;;
  548. X
  549. X  esac
  550. done
  551. X
  552. if test -n "$ac_prev"; then
  553. X  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
  554. fi
  555. X
  556. trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15
  557. X
  558. # File descriptor usage:
  559. # 0 unused; standard input
  560. # 1 file creation
  561. # 2 errors and warnings
  562. # 3 unused; some systems may open it to /dev/tty
  563. # 4 checking for... messages and results
  564. # 5 compiler messages saved in config.log
  565. if test "$silent" = yes; then
  566. X  exec 4>/dev/null
  567. else
  568. X  exec 4>&1
  569. fi
  570. exec 5>./config.log
  571. X
  572. echo "\
  573. This file contains any messages produced by compilers while
  574. running configure, to aid debugging if configure makes a mistake.
  575. " 1>&5
  576. X
  577. # Strip out --no-create and --no-recursion so they do not pile up.
  578. # Also quote any args containing shell metacharacters.
  579. ac_configure_args=
  580. for ac_arg
  581. do
  582. X  case "$ac_arg" in
  583. X  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
  584. X  | --no-cr | --no-c) ;;
  585. X  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
  586. X  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
  587. X  *" "*|*"    "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
  588. X  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
  589. X  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
  590. X  esac
  591. done
  592. X
  593. # NLS nuisances.
  594. # Only set LANG and LC_ALL to C if already set.
  595. # These must not be set unconditionally because not all systems understand
  596. # e.g. LANG=C (notably SCO).
  597. if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
  598. if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
  599. X
  600. # confdefs.h avoids OS command line length limits that DEFS can exceed.
  601. rm -rf conftest* confdefs.h
  602. # AIX cpp loses on an empty file, so make sure it contains at least a newline.
  603. echo > confdefs.h
  604. X
  605. # A filename unique to this package, relative to the directory that
  606. # configure is in, which we can look for to find out if srcdir is correct.
  607. ac_unique_file=gsftopk.c
  608. X
  609. # Find the source files, if location was not specified.
  610. if test -z "$srcdir"; then
  611. X  ac_srcdir_defaulted=yes
  612. X  # Try the directory containing this script, then its parent.
  613. X  ac_prog=$0
  614. X  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
  615. X  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
  616. X  srcdir=$ac_confdir
  617. X  if test ! -r $srcdir/$ac_unique_file; then
  618. X    srcdir=..
  619. X  fi
  620. else
  621. X  ac_srcdir_defaulted=no
  622. fi
  623. if test ! -r $srcdir/$ac_unique_file; then
  624. X  if test "$ac_srcdir_defaulted" = yes; then
  625. X    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
  626. X  else
  627. X    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
  628. X  fi
  629. fi
  630. srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
  631. X
  632. # Prefer explicitly selected file to automatically selected ones.
  633. if test -z "$CONFIG_SITE"; then
  634. X  if test "x$prefix" != xNONE; then
  635. X    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
  636. X  else
  637. X    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
  638. X  fi
  639. fi
  640. for ac_site_file in $CONFIG_SITE; do
  641. X  if test -r "$ac_site_file"; then
  642. X    echo "loading site script $ac_site_file"
  643. X    . "$ac_site_file"
  644. X  fi
  645. done
  646. X
  647. if test -r "$cache_file"; then
  648. X  echo "loading cache $cache_file"
  649. X  . $cache_file
  650. else
  651. X  echo "creating cache $cache_file"
  652. X  > $cache_file
  653. fi
  654. X
  655. ac_ext=c
  656. # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
  657. ac_cpp='$CPP $CPPFLAGS'
  658. ac_compile='${CC-cc} $CFLAGS $CPPFLAGS conftest.$ac_ext -c 1>&5 2>&5'
  659. ac_link='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext -o conftest $LIBS 1>&5 2>&5'
  660. X
  661. if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
  662. X  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
  663. X  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
  664. X    ac_n= ac_c='
  665. ' ac_t='    '
  666. X  else
  667. X    ac_n=-n ac_c= ac_t=
  668. X  fi
  669. else
  670. X  ac_n= ac_c='\c' ac_t=
  671. fi
  672. X
  673. X
  674. X
  675. X
  676. X
  677. X
  678. echo $ac_n "checking whether ${MAKE-make} sets \$MAKE""... $ac_c" 1>&4
  679. set dummy ${MAKE-make}; ac_make=$2
  680. if eval "test \"`echo '${'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
  681. X  echo $ac_n "(cached) $ac_c" 1>&4
  682. else
  683. X  cat > conftestmake <<\EOF
  684. all:
  685. X    @echo 'ac_maketemp="${MAKE}"'
  686. EOF
  687. # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
  688. eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
  689. if test -n "$ac_maketemp"; then
  690. X  eval ac_cv_prog_make_${ac_make}_set=yes
  691. else
  692. X  eval ac_cv_prog_make_${ac_make}_set=no
  693. fi
  694. rm -f conftestmake
  695. fi
  696. if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
  697. X  echo "$ac_t""yes" 1>&4
  698. X  SET_MAKE=
  699. else
  700. X  echo "$ac_t""no" 1>&4
  701. X  SET_MAKE="MAKE=${MAKE-make}"
  702. fi
  703. X
  704. X
  705. # Extract the first word of "gcc", so it can be a program name with args.
  706. set dummy gcc; ac_word=$2
  707. echo $ac_n "checking for $ac_word""... $ac_c" 1>&4
  708. if eval "test \"`echo '${'ac_cv_prog_CC'+set}'`\" = set"; then
  709. X  echo $ac_n "(cached) $ac_c" 1>&4
  710. else
  711. X  if test -n "$CC"; then
  712. X  ac_cv_prog_CC="$CC" # Let the user override the test.
  713. else
  714. X  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  715. X  for ac_dir in $PATH; do
  716. X    test -z "$ac_dir" && ac_dir=.
  717. X    if test -f $ac_dir/$ac_word; then
  718. X      ac_cv_prog_CC="gcc"
  719. X      break
  720. X    fi
  721. X  done
  722. X  IFS="$ac_save_ifs"
  723. X  test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc"
  724. fi
  725. fi
  726. CC="$ac_cv_prog_CC"
  727. if test -n "$CC"; then
  728. X  echo "$ac_t""$CC" 1>&4
  729. else
  730. X  echo "$ac_t""no" 1>&4
  731. fi
  732. X
  733. X
  734. echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&4
  735. if eval "test \"`echo '${'ac_cv_prog_gcc'+set}'`\" = set"; then
  736. X  echo $ac_n "(cached) $ac_c" 1>&4
  737. else
  738. X  cat > conftest.c <<EOF
  739. #ifdef __GNUC__
  740. X  yes;
  741. #endif
  742. EOF
  743. if ${CC-cc} -E conftest.c 2>&5 | egrep yes >/dev/null 2>&1; then
  744. X  ac_cv_prog_gcc=yes
  745. else
  746. X  ac_cv_prog_gcc=no
  747. fi
  748. fi
  749. echo "$ac_t""$ac_cv_prog_gcc" 1>&4
  750. if test $ac_cv_prog_gcc = yes; then
  751. X  GCC=yes
  752. X  if test "${CFLAGS+set}" != set; then
  753. X    echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&4
  754. if eval "test \"`echo '${'ac_cv_prog_gcc_g'+set}'`\" = set"; then
  755. X  echo $ac_n "(cached) $ac_c" 1>&4
  756. else
  757. X  echo 'void f(){}' > conftest.c
  758. if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
  759. X  ac_cv_prog_gcc_g=yes
  760. else
  761. X  ac_cv_prog_gcc_g=no
  762. fi
  763. rm -f conftest*
  764. X
  765. fi
  766. X    echo "$ac_t""$ac_cv_prog_gcc_g" 1>&4
  767. X    if test $ac_cv_prog_gcc_g = yes; then
  768. X      CFLAGS="-g -O"
  769. X    else
  770. X      CFLAGS="-O"
  771. X    fi
  772. X  fi
  773. else
  774. X  GCC=
  775. X  test "${CFLAGS+set}" = set || CFLAGS="-g"
  776. fi
  777. X
  778. ac_aux_dir=
  779. for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
  780. X  if test -f $ac_dir/install-sh; then
  781. X    ac_aux_dir=$ac_dir
  782. X    ac_install_sh="$ac_aux_dir/install-sh -c"
  783. X    break
  784. X  elif test -f $ac_dir/install.sh; then
  785. X    ac_aux_dir=$ac_dir
  786. X    ac_install_sh="$ac_aux_dir/install.sh -c"
  787. X    break
  788. X  fi
  789. done
  790. if test -z "$ac_aux_dir"; then
  791. X  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
  792. fi
  793. ac_config_guess=$ac_aux_dir/config.guess
  794. ac_config_sub=$ac_aux_dir/config.sub
  795. ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
  796. X
  797. # Find a good install program.  We prefer a C program (faster),
  798. # so one script is as good as another.  But avoid the broken or
  799. # incompatible versions:
  800. # SysV /etc/install, /usr/sbin/install
  801. # SunOS /usr/etc/install
  802. # IRIX /sbin/install
  803. # AIX /bin/install
  804. # AFS /usr/afsws/bin/install, which mishandles nonexistent args
  805. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
  806. # ./install, which can be erroneously created by make from ./install.sh.
  807. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&4
  808. if test -z "$INSTALL"; then
  809. if eval "test \"`echo '${'ac_cv_path_install'+set}'`\" = set"; then
  810. X  echo $ac_n "(cached) $ac_c" 1>&4
  811. else
  812. X    IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  813. X  for ac_dir in $PATH; do
  814. X    case "$ac_dir" in
  815. X    ''|.|/etc|/usr/sbin|/usr/etc|/sbin|/usr/afsws/bin|/usr/ucb) ;;
  816. X    *)
  817. X      # OSF1 and SCO ODT 3.0 have their own names for install.
  818. X      for ac_prog in ginstall installbsd scoinst install; do
  819. X        if test -f $ac_dir/$ac_prog; then
  820. X      if test $ac_prog = install &&
  821. X            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
  822. X        # AIX install.  It has an incompatible calling convention.
  823. X        # OSF/1 installbsd also uses dspmsg, but is usable.
  824. X        :
  825. X      else
  826. X        ac_cv_path_install="$ac_dir/$ac_prog -c"
  827. X        break 2
  828. X      fi
  829. X    fi
  830. X      done
  831. X      ;;
  832. X    esac
  833. X  done
  834. X  IFS="$ac_save_ifs"
  835. X  # As a last resort, use the slow shell script.
  836. X  test -z "$ac_cv_path_install" && ac_cv_path_install="$ac_install_sh"
  837. fi
  838. X  INSTALL="$ac_cv_path_install"
  839. fi
  840. echo "$ac_t""$INSTALL" 1>&4
  841. X
  842. # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
  843. # It thinks the first close brace ends the variable substitution.
  844. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
  845. X
  846. test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
  847. X
  848. # Extract the first word of "ranlib", so it can be a program name with args.
  849. set dummy ranlib; ac_word=$2
  850. echo $ac_n "checking for $ac_word""... $ac_c" 1>&4
  851. if eval "test \"`echo '${'ac_cv_prog_RANLIB'+set}'`\" = set"; then
  852. X  echo $ac_n "(cached) $ac_c" 1>&4
  853. else
  854. X  if test -n "$RANLIB"; then
  855. X  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
  856. else
  857. X  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  858. X  for ac_dir in $PATH; do
  859. X    test -z "$ac_dir" && ac_dir=.
  860. X    if test -f $ac_dir/$ac_word; then
  861. X      ac_cv_prog_RANLIB="ranlib"
  862. X      break
  863. X    fi
  864. X  done
  865. X  IFS="$ac_save_ifs"
  866. X  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
  867. fi
  868. fi
  869. RANLIB="$ac_cv_prog_RANLIB"
  870. if test -n "$RANLIB"; then
  871. X  echo "$ac_t""$RANLIB" 1>&4
  872. else
  873. X  echo "$ac_t""no" 1>&4
  874. fi
  875. X
  876. X
  877. echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&4
  878. if test -d /etc/conf/kconfig.d &&
  879. X  grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  880. then
  881. X  echo "$ac_t""yes" 1>&4
  882. X  ISC=yes # If later tests want to check for ISC.
  883. X  cat >> confdefs.h <<\EOF
  884. #define _POSIX_SOURCE 1
  885. EOF
  886. X
  887. X  if test "$GCC" = yes; then
  888. X    CC="$CC -posix"
  889. X  else
  890. X    CC="$CC -Xp"
  891. X  fi
  892. else
  893. X  echo "$ac_t""no" 1>&4
  894. X  ISC=
  895. fi
  896. X
  897. X
  898. ac_header_dirent=no
  899. for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
  900. do
  901. ac_safe=`echo "$ac_hdr" | tr './\055' '___'`
  902. echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&4
  903. if eval "test \"`echo '${'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
  904. X  echo $ac_n "(cached) $ac_c" 1>&4
  905. else
  906. X  cat > conftest.$ac_ext <<EOF
  907. #line 634 "configure"
  908. #include "confdefs.h"
  909. #include <sys/types.h>
  910. #include <$ac_hdr>
  911. int main() { return 0; }
  912. int t() {
  913. DIR *dirp = 0;
  914. ; return 0; }
  915. EOF
  916. if eval $ac_compile; then
  917. X  rm -rf conftest*
  918. X  eval "ac_cv_header_dirent_$ac_safe=yes"
  919. else
  920. X  rm -rf conftest*
  921. X  eval "ac_cv_header_dirent_$ac_safe=no"
  922. fi
  923. rm -f conftest*
  924. X
  925. fi
  926. if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
  927. X  echo "$ac_t""yes" 1>&4
  928. X    ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'`
  929. X  cat >> confdefs.h <<EOF
  930. #define $ac_tr_hdr 1
  931. EOF
  932. X ac_header_dirent=$ac_hdr; break
  933. else
  934. X  echo "$ac_t""no" 1>&4
  935. fi
  936. done
  937. # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
  938. if test $ac_header_dirent = dirent.h; then
  939. echo $ac_n "checking for -ldir""... $ac_c" 1>&4
  940. if eval "test \"`echo '${'ac_cv_lib_dir'+set}'`\" = set"; then
  941. X  echo $ac_n "(cached) $ac_c" 1>&4
  942. else
  943. X  ac_save_LIBS="$LIBS"
  944. LIBS="$LIBS -ldir "
  945. cat > conftest.$ac_ext <<EOF
  946. #line 673 "configure"
  947. #include "confdefs.h"
  948. X
  949. int main() { return 0; }
  950. int t() {
  951. opendir()
  952. ; return 0; }
  953. EOF
  954. if eval $ac_link; then
  955. X  rm -rf conftest*
  956. X  eval "ac_cv_lib_dir=yes"
  957. else
  958. X  rm -rf conftest*
  959. X  eval "ac_cv_lib_dir=no"
  960. fi
  961. rm -f conftest*
  962. LIBS="$ac_save_LIBS"
  963. X
  964. fi
  965. if eval "test \"`echo '$ac_cv_lib_'dir`\" = yes"; then
  966. X  echo "$ac_t""yes" 1>&4
  967. X  LIBS="$LIBS -ldir"
  968. else
  969. X  echo "$ac_t""no" 1>&4
  970. fi
  971. X
  972. else
  973. echo $ac_n "checking for -lx""... $ac_c" 1>&4
  974. if eval "test \"`echo '${'ac_cv_lib_x'+set}'`\" = set"; then
  975. X  echo $ac_n "(cached) $ac_c" 1>&4
  976. else
  977. X  ac_save_LIBS="$LIBS"
  978. LIBS="$LIBS -lx "
  979. cat > conftest.$ac_ext <<EOF
  980. #line 707 "configure"
  981. #include "confdefs.h"
  982. X
  983. int main() { return 0; }
  984. int t() {
  985. opendir()
  986. ; return 0; }
  987. EOF
  988. if eval $ac_link; then
  989. X  rm -rf conftest*
  990. X  eval "ac_cv_lib_x=yes"
  991. else
  992. X  rm -rf conftest*
  993. X  eval "ac_cv_lib_x=no"
  994. fi
  995. rm -f conftest*
  996. LIBS="$ac_save_LIBS"
  997. X
  998. fi
  999. if eval "test \"`echo '$ac_cv_lib_'x`\" = yes"; then
  1000. X  echo "$ac_t""yes" 1>&4
  1001. X  LIBS="$LIBS -lx"
  1002. else
  1003. X  echo "$ac_t""no" 1>&4
  1004. fi
  1005. X
  1006. fi
  1007. X
  1008. echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&4
  1009. # On Suns, sometimes $CPP names a directory.
  1010. if test -n "$CPP" && test -d "$CPP"; then
  1011. X  CPP=
  1012. fi
  1013. if test -z "$CPP"; then
  1014. if eval "test \"`echo '${'ac_cv_prog_CPP'+set}'`\" = set"; then
  1015. X  echo $ac_n "(cached) $ac_c" 1>&4
  1016. else
  1017. X    # This must be in double quotes, not single quotes, because CPP may get
  1018. X  # substituted into the Makefile and "${CC-cc}" will confuse make.
  1019. X  CPP="${CC-cc} -E"
  1020. X  # On the NeXT, cc -E runs the code through the compiler's parser,
  1021. X  # not just through cpp.
  1022. X  cat > conftest.$ac_ext <<EOF
  1023. #line 750 "configure"
  1024. #include "confdefs.h"
  1025. #include <assert.h>
  1026. Syntax Error
  1027. EOF
  1028. eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  1029. ac_err=`grep -v '^ *+' conftest.out`
  1030. if test -z "$ac_err"; then
  1031. X  :
  1032. else
  1033. X  echo "$ac_err" >&5
  1034. X  rm -rf conftest*
  1035. X  CPP="${CC-cc} -E -traditional-cpp"
  1036. X  cat > conftest.$ac_ext <<EOF
  1037. #line 764 "configure"
  1038. #include "confdefs.h"
  1039. #include <assert.h>
  1040. Syntax Error
  1041. EOF
  1042. eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  1043. ac_err=`grep -v '^ *+' conftest.out`
  1044. if test -z "$ac_err"; then
  1045. X  :
  1046. else
  1047. X  echo "$ac_err" >&5
  1048. X  rm -rf conftest*
  1049. X  CPP=/lib/cpp
  1050. fi
  1051. rm -f conftest*
  1052. fi
  1053. rm -f conftest*
  1054. X  ac_cv_prog_CPP="$CPP"
  1055. fi
  1056. fi
  1057. CPP="$ac_cv_prog_CPP"
  1058. echo "$ac_t""$CPP" 1>&4
  1059. X
  1060. # If we cannot run a trivial program, we must be cross compiling.
  1061. echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&4
  1062. if eval "test \"`echo '${'ac_cv_c_cross'+set}'`\" = set"; then
  1063. X  echo $ac_n "(cached) $ac_c" 1>&4
  1064. else
  1065. X  if test "$cross_compiling" = yes; then
  1066. X  ac_cv_cross=yes
  1067. else
  1068. cat > conftest.$ac_ext <<EOF
  1069. #line 796 "configure"
  1070. #include "confdefs.h"
  1071. main(){return(0);}
  1072. EOF
  1073. eval $ac_link
  1074. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1075. X  ac_cv_c_cross=no
  1076. else
  1077. X  ac_cv_c_cross=yes
  1078. fi
  1079. fi
  1080. rm -fr conftest*
  1081. fi
  1082. cross_compiling=$ac_cv_c_cross
  1083. echo "$ac_t""$ac_cv_c_cross" 1>&4
  1084. X
  1085. echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&4
  1086. if eval "test \"`echo '${'ac_cv_header_stdc'+set}'`\" = set"; then
  1087. X  echo $ac_n "(cached) $ac_c" 1>&4
  1088. else
  1089. X  cat > conftest.$ac_ext <<EOF
  1090. #line 817 "configure"
  1091. #include "confdefs.h"
  1092. #include <stdlib.h>
  1093. #include <stdarg.h>
  1094. #include <string.h>
  1095. #include <float.h>
  1096. EOF
  1097. eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  1098. ac_err=`grep -v '^ *+' conftest.out`
  1099. if test -z "$ac_err"; then
  1100. X  rm -rf conftest*
  1101. X  ac_cv_header_stdc=yes
  1102. else
  1103. X  echo "$ac_err" >&5
  1104. X  rm -rf conftest*
  1105. X  ac_cv_header_stdc=no
  1106. fi
  1107. rm -f conftest*
  1108. X
  1109. if test $ac_cv_header_stdc = yes; then
  1110. X  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
  1111. cat > conftest.$ac_ext <<EOF
  1112. #line 839 "configure"
  1113. #include "confdefs.h"
  1114. #include <string.h>
  1115. EOF
  1116. if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  1117. X  egrep "memchr" >/dev/null 2>&1; then
  1118. X  :
  1119. else
  1120. X  rm -rf conftest*
  1121. X  ac_cv_header_stdc=no
  1122. fi
  1123. rm -f conftest*
  1124. X
  1125. fi
  1126. X
  1127. if test $ac_cv_header_stdc = yes; then
  1128. X  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
  1129. cat > conftest.$ac_ext <<EOF
  1130. #line 857 "configure"
  1131. #include "confdefs.h"
  1132. #include <stdlib.h>
  1133. EOF
  1134. if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  1135. X  egrep "free" >/dev/null 2>&1; then
  1136. X  :
  1137. else
  1138. X  rm -rf conftest*
  1139. X  ac_cv_header_stdc=no
  1140. fi
  1141. rm -f conftest*
  1142. X
  1143. fi
  1144. X
  1145. if test $ac_cv_header_stdc = yes; then
  1146. X  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
  1147. if test "$cross_compiling" = yes; then
  1148. X  ac_cv_header_stdc=no
  1149. else
  1150. cat > conftest.$ac_ext <<EOF
  1151. #line 878 "configure"
  1152. #include "confdefs.h"
  1153. #include <ctype.h>
  1154. #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
  1155. #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
  1156. #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
  1157. int main () { int i; for (i = 0; i < 256; i++)
  1158. if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
  1159. exit (0); }
  1160. X
  1161. EOF
  1162. eval $ac_link
  1163. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1164. X  :
  1165. else
  1166. X  ac_cv_header_stdc=no
  1167. fi
  1168. fi
  1169. rm -fr conftest*
  1170. fi
  1171. fi
  1172. echo "$ac_t""$ac_cv_header_stdc" 1>&4
  1173. if test $ac_cv_header_stdc = yes; then
  1174. X  cat >> confdefs.h <<\EOF
  1175. #define STDC_HEADERS 1
  1176. EOF
  1177. X
  1178. fi
  1179. X
  1180. echo $ac_n "checking whether closedir returns void""... $ac_c" 1>&4
  1181. if eval "test \"`echo '${'ac_cv_func_closedir_void'+set}'`\" = set"; then
  1182. X  echo $ac_n "(cached) $ac_c" 1>&4
  1183. else
  1184. X  if test "$cross_compiling" = yes; then
  1185. X    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
  1186. else
  1187. cat > conftest.$ac_ext <<EOF
  1188. #line 915 "configure"
  1189. #include "confdefs.h"
  1190. #include <sys/types.h>
  1191. #include <$ac_header_dirent>
  1192. int closedir(); main() { exit(closedir(opendir(".")) != 0); }
  1193. EOF
  1194. eval $ac_link
  1195. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1196. X  ac_cv_func_closedir_void=no
  1197. else
  1198. X  ac_cv_func_closedir_void=yes
  1199. fi
  1200. fi
  1201. rm -fr conftest*
  1202. fi
  1203. echo "$ac_t""$ac_cv_func_closedir_void" 1>&4
  1204. if test $ac_cv_func_closedir_void = yes; then
  1205. X  cat >> confdefs.h <<\EOF
  1206. #define CLOSEDIR_VOID 1
  1207. EOF
  1208. X
  1209. fi
  1210. X
  1211. for ac_hdr in assert.h float.h limits.h memory.h pwd.h stdlib.h \
  1212. X                 string.h unistd.h
  1213. do
  1214. ac_safe=`echo "$ac_hdr" | tr './\055' '___'`
  1215. echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&4
  1216. if eval "test \"`echo '${'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  1217. X  echo $ac_n "(cached) $ac_c" 1>&4
  1218. else
  1219. X  cat > conftest.$ac_ext <<EOF
  1220. #line 947 "configure"
  1221. #include "confdefs.h"
  1222. #include <$ac_hdr>
  1223. EOF
  1224. eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  1225. ac_err=`grep -v '^ *+' conftest.out`
  1226. if test -z "$ac_err"; then
  1227. X  rm -rf conftest*
  1228. X  eval "ac_cv_header_$ac_safe=yes"
  1229. else
  1230. X  echo "$ac_err" >&5
  1231. X  rm -rf conftest*
  1232. X  eval "ac_cv_header_$ac_safe=no"
  1233. fi
  1234. rm -f conftest*
  1235. fi
  1236. if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
  1237. X  echo "$ac_t""yes" 1>&4
  1238. X    ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'`
  1239. X  cat >> confdefs.h <<EOF
  1240. #define $ac_tr_hdr 1
  1241. EOF
  1242. else
  1243. X  echo "$ac_t""no" 1>&4
  1244. fi
  1245. done
  1246. X
  1247. X
  1248. for ac_func in basename bcopy memmove putenv
  1249. do
  1250. echo $ac_n "checking for $ac_func""... $ac_c" 1>&4
  1251. if eval "test \"`echo '${'ac_cv_func_$ac_func'+set}'`\" = set"; then
  1252. X  echo $ac_n "(cached) $ac_c" 1>&4
  1253. else
  1254. X  cat > conftest.$ac_ext <<EOF
  1255. #line 983 "configure"
  1256. #include "confdefs.h"
  1257. #include <ctype.h> /* Arbitrary system header to define __stub macros. */
  1258. /* Override any gcc2 internal prototype to avoid an error.  */
  1259. char $ac_func(); 
  1260. X
  1261. int main() { return 0; }
  1262. int t() {
  1263. X
  1264. /* The GNU C library defines this for functions which it implements
  1265. X    to always fail with ENOSYS.  Some functions are actually named
  1266. X    something starting with __ and the normal name is an alias.  */
  1267. #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
  1268. choke me
  1269. #else
  1270. $ac_func();
  1271. #endif
  1272. X
  1273. ; return 0; }
  1274. EOF
  1275. if eval $ac_link; then
  1276. X  rm -rf conftest*
  1277. X  eval "ac_cv_func_$ac_func=yes"
  1278. else
  1279. X  rm -rf conftest*
  1280. X  eval "ac_cv_func_$ac_func=no"
  1281. fi
  1282. rm -f conftest*
  1283. X
  1284. fi
  1285. if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
  1286. X  echo "$ac_t""yes" 1>&4
  1287. X    ac_tr_func=HAVE_`echo $ac_func | tr '[a-z]' '[A-Z]'`
  1288. X  cat >> confdefs.h <<EOF
  1289. #define $ac_tr_func 1
  1290. EOF
  1291. else
  1292. X  echo "$ac_t""no" 1>&4
  1293. fi
  1294. done
  1295. X
  1296. X
  1297. echo $ac_n "checking for working const""... $ac_c" 1>&4
  1298. if eval "test \"`echo '${'ac_cv_c_const'+set}'`\" = set"; then
  1299. X  echo $ac_n "(cached) $ac_c" 1>&4
  1300. else
  1301. X  cat > conftest.$ac_ext <<EOF
  1302. #line 1031 "configure"
  1303. #include "confdefs.h"
  1304. X
  1305. int main() { return 0; }
  1306. int t() {
  1307. X
  1308. /* Ultrix mips cc rejects this.  */
  1309. typedef int charset[2]; const charset x;
  1310. /* SunOS 4.1.1 cc rejects this.  */
  1311. char const *const *ccp;
  1312. char **p;
  1313. /* NEC SVR4.0.2 mips cc rejects this.  */
  1314. struct point {int x, y;};
  1315. static struct point const zero;
  1316. /* AIX XL C 1.02.0.0 rejects this.
  1317. X   It does not let you subtract one const X* pointer from another in an arm
  1318. X   of an if-expression whose if-part is not a constant expression */
  1319. const char *g = "string";
  1320. ccp = &g + (g ? g-g : 0);
  1321. /* HPUX 7.0 cc rejects these. */
  1322. ++ccp;
  1323. p = (char**) ccp;
  1324. ccp = (char const *const *) p;
  1325. { /* SCO 3.2v4 cc rejects this.  */
  1326. X  char *t;
  1327. X  char const *s = 0 ? (char *) 0 : (char const *) 0;
  1328. X
  1329. X  *t++ = 0;
  1330. }
  1331. { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
  1332. X  int x[] = {25, 17};
  1333. X  const int *foo = &x[0];
  1334. X  ++foo;
  1335. }
  1336. { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
  1337. X  typedef const int *iptr;
  1338. X  iptr p = 0;
  1339. X  ++p;
  1340. }
  1341. { /* AIX XL C 1.02.0.0 rejects this saying
  1342. X     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
  1343. X  struct s { int j; const int *ap[3]; };
  1344. X  struct s *b; b->j = 5;
  1345. }
  1346. { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
  1347. X  const int foo = 10;
  1348. }
  1349. X
  1350. ; return 0; }
  1351. EOF
  1352. if eval $ac_compile; then
  1353. X  rm -rf conftest*
  1354. X  ac_cv_c_const=yes
  1355. else
  1356. X  rm -rf conftest*
  1357. X  ac_cv_c_const=no
  1358. fi
  1359. rm -f conftest*
  1360. X
  1361. fi
  1362. echo "$ac_t""$ac_cv_c_const" 1>&4
  1363. if test $ac_cv_c_const = no; then
  1364. X  cat >> confdefs.h <<\EOF
  1365. #define const 
  1366. EOF
  1367. X
  1368. fi
  1369. X
  1370. X
  1371. X
  1372. # This is a GNU libc invention.
  1373. echo $ac_n "checking whether program_invocation_name is predefined""... $ac_c" 1>&4
  1374. if eval "test \"`echo '${'kb_cv_var_program_inv_name'+set}'`\" = set"; then
  1375. X  echo $ac_n "(cached) $ac_c" 1>&4
  1376. else
  1377. X  cat > conftest.$ac_ext <<EOF
  1378. #line 1107 "configure"
  1379. #include "confdefs.h"
  1380. X
  1381. int main() { return 0; }
  1382. int t() {
  1383. main() { program_invocation_name = "love"; }
  1384. ; return 0; }
  1385. EOF
  1386. if eval $ac_link; then
  1387. X  rm -rf conftest*
  1388. X  kb_cv_var_program_inv_name=yes
  1389. else
  1390. X  rm -rf conftest*
  1391. X  kb_cv_var_program_inv_name=no
  1392. fi
  1393. rm -f conftest*
  1394. X
  1395. fi
  1396. echo "$ac_t""$kb_cv_var_program_inv_name" 1>&4
  1397. if test $kb_cv_var_program_inv_name = yes; then
  1398. X  cat >> confdefs.h <<\EOF
  1399. #define HAVE_PROGRAM_INVOCATION_NAME 1
  1400. EOF
  1401. X
  1402. fi
  1403. X
  1404. X
  1405. # Some BSD putenv's, e.g., FreeBSD, do malloc/free's on the environment.
  1406. # This test program is due to Mike Hibler <mike@cs.utah.edu>.
  1407. # We don't actually need to run this if we don't have putenv, but it
  1408. # doesn't hurt.
  1409. echo $ac_n "checking whether putenv uses malloc""... $ac_c" 1>&4
  1410. if eval "test \"`echo '${'kb_cv_func_putenv_malloc'+set}'`\" = set"; then
  1411. X  echo $ac_n "(cached) $ac_c" 1>&4
  1412. else
  1413. X  if test "$cross_compiling" = yes; then
  1414. X  kb_cv_func_putenv_malloc=no
  1415. else
  1416. cat > conftest.$ac_ext <<EOF
  1417. #line 1146 "configure"
  1418. #include "confdefs.h"
  1419. X
  1420. #define VAR    "YOW_VAR"
  1421. #define STRING1 "GabbaGabbaHey"
  1422. #define STRING2 "Yow!!"        /* should be shorter than STRING1 */
  1423. extern char *getenv (); /* in case char* and int don't mix gracefully */
  1424. main ()
  1425. {
  1426. X  char *str1, *rstr1, *str2, *rstr2;
  1427. X  str1 = getenv (VAR);
  1428. X  if (str1)
  1429. X    exit (1);
  1430. X  str1 = malloc (strlen (VAR) + 1 + strlen (STRING1) + 1);
  1431. X  if (str1 == 0)
  1432. X    exit (2);
  1433. X  strcpy (str1, VAR);
  1434. X  strcat (str1, "=");
  1435. X  strcat (str1, STRING1);
  1436. X  if (putenv (str1) < 0)
  1437. X    exit (3);
  1438. X  rstr1 = getenv (VAR);
  1439. X  if (rstr1 == 0)
  1440. X    exit (4);
  1441. X  rstr1 -= strlen (VAR) + 1;
  1442. X  if (strncmp (rstr1, VAR, strlen (VAR)))
  1443. X    exit (5);
  1444. X  str2 = malloc (strlen (VAR) + 1 + strlen (STRING2) + 1);
  1445. X  if (str2 == 0 || str1 == str2)
  1446. X    exit (6);
  1447. X  strcpy (str2, VAR);
  1448. X  strcat (str2, "=");
  1449. X  strcat (str2, STRING2);
  1450. X  if (putenv (str2) < 0)
  1451. X    exit (7);
  1452. X  rstr2 = getenv (VAR);
  1453. X  if (rstr2 == 0)
  1454. X    exit (8);
  1455. X  rstr2 -= strlen (VAR) + 1;
  1456. #if 0
  1457. X  printf ("rstr1=0x%x, rstr2=0x%x\n", rstr1, rstr2);
  1458. X  /*
  1459. X   * If string from first call was reused for the second call,
  1460. X   * you had better not do a free on the first string!
  1461. X   */
  1462. X  if (rstr1 == rstr2)
  1463. X          printf ("#define SMART_PUTENV\n");
  1464. X  else
  1465. X          printf ("#undef SMART_PUTENV\n");
  1466. #endif
  1467. X  exit (rstr1 == rstr2 ? 0 : 1);
  1468. }
  1469. EOF
  1470. eval $ac_link
  1471. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1472. X  kb_cv_func_putenv_malloc=yes
  1473. else
  1474. X  kb_cv_func_putenv_malloc=no
  1475. fi
  1476. fi
  1477. rm -fr conftest*
  1478. fi
  1479. echo "$ac_t""$kb_cv_func_putenv_malloc" 1>&4
  1480. if test $kb_cv_func_putenv_malloc = yes; then
  1481. X  cat >> confdefs.h <<\EOF
  1482. #define SMART_PUTENV 1
  1483. EOF
  1484. X
  1485. fi
  1486. X
  1487. X
  1488. echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&4
  1489. if eval "test \"`echo '${'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
  1490. X  echo $ac_n "(cached) $ac_c" 1>&4
  1491. else
  1492. X  cat > conftest.$ac_ext <<EOF
  1493. #line 1222 "configure"
  1494. #include "confdefs.h"
  1495. #include <sys/types.h>
  1496. #include <sys/wait.h>
  1497. #ifndef WEXITSTATUS
  1498. #define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
  1499. #endif
  1500. #ifndef WIFEXITED
  1501. #define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
  1502. #endif
  1503. int main() { return 0; }
  1504. int t() {
  1505. int s;
  1506. wait (&s);
  1507. s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
  1508. ; return 0; }
  1509. EOF
  1510. if eval $ac_compile; then
  1511. X  rm -rf conftest*
  1512. X  ac_cv_header_sys_wait_h=yes
  1513. else
  1514. X  rm -rf conftest*
  1515. X  ac_cv_header_sys_wait_h=no
  1516. fi
  1517. rm -f conftest*
  1518. X
  1519. fi
  1520. echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&4
  1521. if test $ac_cv_header_sys_wait_h = yes; then
  1522. X  cat >> confdefs.h <<\EOF
  1523. #define HAVE_SYS_WAIT_H 1
  1524. EOF
  1525. X
  1526. fi
  1527. X
  1528. X
  1529. echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&4
  1530. if eval "test \"`echo '${'ac_cv_func_memcmp'+set}'`\" = set"; then
  1531. X  echo $ac_n "(cached) $ac_c" 1>&4
  1532. else
  1533. X  if test "$cross_compiling" = yes; then
  1534. X  ac_cv_func_memcmp=no
  1535. else
  1536. cat > conftest.$ac_ext <<EOF
  1537. #line 1266 "configure"
  1538. #include "confdefs.h"
  1539. X
  1540. main()
  1541. {
  1542. X  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
  1543. X  exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
  1544. }
  1545. X
  1546. EOF
  1547. eval $ac_link
  1548. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1549. X  ac_cv_func_memcmp=yes
  1550. else
  1551. X  ac_cv_func_memcmp=no
  1552. fi
  1553. fi
  1554. rm -fr conftest*
  1555. fi
  1556. echo "$ac_t""$ac_cv_func_memcmp" 1>&4
  1557. test $ac_cv_func_memcmp = no && LIBOBJS="$LIBOBJS memcmp.o"
  1558. X
  1559. echo $ac_n "checking for pid_t""... $ac_c" 1>&4
  1560. if eval "test \"`echo '${'ac_cv_type_pid_t'+set}'`\" = set"; then
  1561. X  echo $ac_n "(cached) $ac_c" 1>&4
  1562. else
  1563. X  cat > conftest.$ac_ext <<EOF
  1564. #line 1293 "configure"
  1565. #include "confdefs.h"
  1566. #include <sys/types.h>
  1567. #if STDC_HEADERS
  1568. #include <stdlib.h>
  1569. #endif
  1570. EOF
  1571. if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  1572. X  egrep "pid_t" >/dev/null 2>&1; then
  1573. X  rm -rf conftest*
  1574. X  ac_cv_type_pid_t=yes
  1575. else
  1576. X  rm -rf conftest*
  1577. X  ac_cv_type_pid_t=no
  1578. fi
  1579. rm -f conftest*
  1580. X
  1581. fi
  1582. echo "$ac_t""$ac_cv_type_pid_t" 1>&4
  1583. if test $ac_cv_type_pid_t = no; then
  1584. X  cat >> confdefs.h <<\EOF
  1585. #define pid_t int
  1586. EOF
  1587. X
  1588. fi
  1589. X
  1590. echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&4
  1591. if eval "test \"`echo '${'ac_cv_type_signal'+set}'`\" = set"; then
  1592. X  echo $ac_n "(cached) $ac_c" 1>&4
  1593. else
  1594. X  cat > conftest.$ac_ext <<EOF
  1595. #line 1324 "configure"
  1596. #include "confdefs.h"
  1597. #include <sys/types.h>
  1598. #include <signal.h>
  1599. #ifdef signal
  1600. #undef signal
  1601. #endif
  1602. extern void (*signal ()) ();
  1603. int main() { return 0; }
  1604. int t() {
  1605. int i;
  1606. ; return 0; }
  1607. EOF
  1608. if eval $ac_compile; then
  1609. X  rm -rf conftest*
  1610. X  ac_cv_type_signal=void
  1611. else
  1612. X  rm -rf conftest*
  1613. X  ac_cv_type_signal=int
  1614. fi
  1615. rm -f conftest*
  1616. X
  1617. fi
  1618. echo "$ac_t""$ac_cv_type_signal" 1>&4
  1619. cat >> confdefs.h <<EOF
  1620. #define RETSIGTYPE $ac_cv_type_signal
  1621. EOF
  1622. X
  1623. X
  1624. ac_safe=`echo "vfork.h" | tr './\055' '___'`
  1625. echo $ac_n "checking for vfork.h""... $ac_c" 1>&4
  1626. if eval "test \"`echo '${'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  1627. X  echo $ac_n "(cached) $ac_c" 1>&4
  1628. else
  1629. X  cat > conftest.$ac_ext <<EOF
  1630. #line 1359 "configure"
  1631. #include "confdefs.h"
  1632. #include <vfork.h>
  1633. EOF
  1634. eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  1635. ac_err=`grep -v '^ *+' conftest.out`
  1636. if test -z "$ac_err"; then
  1637. X  rm -rf conftest*
  1638. X  eval "ac_cv_header_$ac_safe=yes"
  1639. else
  1640. X  echo "$ac_err" >&5
  1641. X  rm -rf conftest*
  1642. X  eval "ac_cv_header_$ac_safe=no"
  1643. fi
  1644. rm -f conftest*
  1645. fi
  1646. if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
  1647. X  echo "$ac_t""yes" 1>&4
  1648. X  cat >> confdefs.h <<\EOF
  1649. #define HAVE_VFORK_H 1
  1650. EOF
  1651. X
  1652. else
  1653. X  echo "$ac_t""no" 1>&4
  1654. fi
  1655. X
  1656. echo $ac_n "checking for working vfork""... $ac_c" 1>&4
  1657. if eval "test \"`echo '${'ac_cv_func_vfork'+set}'`\" = set"; then
  1658. X  echo $ac_n "(cached) $ac_c" 1>&4
  1659. else
  1660. X  
  1661. if test "$cross_compiling" = yes; then
  1662. X  ac_cv_func_vfork=no
  1663. else
  1664. cat > conftest.$ac_ext <<EOF
  1665. #line 1394 "configure"
  1666. #include "confdefs.h"
  1667. /* Thanks to Paul Eggert for this test.  */
  1668. #include <stdio.h>
  1669. #include <sys/types.h>
  1670. #include <sys/stat.h>
  1671. #include <signal.h>
  1672. #ifdef HAVE_UNISTD_H
  1673. #include <unistd.h>
  1674. #endif
  1675. #ifdef HAVE_VFORK_H
  1676. #include <vfork.h>
  1677. #endif
  1678. /* On sparc systems, changes by the child to local and incoming
  1679. X   argument registers are propagated back to the parent.
  1680. X   The compiler is told about this with #include <vfork.h>,
  1681. X   but some compilers (e.g. gcc -O) don't grok <vfork.h>.
  1682. X   Test for this by using a static variable whose address
  1683. X   is put into a register that is clobbered by the vfork.  */
  1684. static
  1685. #ifdef __cplusplus
  1686. sparc_address_test (int arg)
  1687. #else
  1688. sparc_address_test (arg) int arg;
  1689. #endif
  1690. {
  1691. X  static pid_t child;
  1692. X  if (!child) {
  1693. X    child = vfork ();
  1694. X    if (child < 0)
  1695. X      perror ("vfork");
  1696. X    if (!child) {
  1697. X      arg = getpid();
  1698. X      write(-1, "", 0);
  1699. X      _exit (arg);
  1700. X    }
  1701. X  }
  1702. }
  1703. static int signalled;
  1704. static RETSIGTYPE catch (s) int s; { signalled = 1; }
  1705. main() {
  1706. X  pid_t parent = getpid ();
  1707. X  pid_t child;
  1708. X
  1709. X  sparc_address_test ();
  1710. X
  1711. X  signal (SIGINT, catch);
  1712. X
  1713. X  child = vfork ();
  1714. X
  1715. X  if (child == 0) {
  1716. X    /* Here is another test for sparc vfork register problems.
  1717. X       This test uses lots of local variables, at least
  1718. X       as many local variables as main has allocated so far
  1719. X       including compiler temporaries.  4 locals are enough for
  1720. X       gcc 1.40.3 on a sparc, but we use 8 to be safe.
  1721. X       A buggy compiler should reuse the register of parent
  1722. X       for one of the local variables, since it will think that
  1723. X       parent can't possibly be used any more in this routine.
  1724. X       Assigning to the local variable will thus munge parent
  1725. X       in the parent process.  */
  1726. X    pid_t
  1727. X      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
  1728. X      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
  1729. X    /* Convince the compiler that p..p7 are live; otherwise, it might
  1730. X       use the same hardware register for all 8 local variables.  */
  1731. X    if (p != p1 || p != p2 || p != p3 || p != p4
  1732. X    || p != p5 || p != p6 || p != p7)
  1733. X      _exit(1);
  1734. X
  1735. X    /* On some systems (e.g. SunOS 5.2), if the parent is catching
  1736. X       a signal, the child ignores the signal before execing,
  1737. X       and the parent later receives that signal, the parent dumps core.
  1738. X       Test for this by ignoring SIGINT in the child.  */
  1739. X    signal (SIGINT, SIG_IGN);
  1740. X
  1741. X    /* On some systems (e.g. IRIX 3.3),
  1742. X       vfork doesn't separate parent from child file descriptors.
  1743. X       If the child closes a descriptor before it execs or exits,
  1744. X       this munges the parent's descriptor as well.
  1745. X       Test for this by closing stdout in the child.  */
  1746. X    _exit(close(fileno(stdout)) != 0);
  1747. X  } else {
  1748. X    int status;
  1749. X    struct stat st;
  1750. X
  1751. X    while (wait(&status) != child)
  1752. X      ;
  1753. X    exit(
  1754. X     /* Was there some problem with vforking?  */
  1755. X     child < 0
  1756. X
  1757. X     /* Did the child fail?  (This shouldn't happen.)  */
  1758. X     || status
  1759. X
  1760. X     /* Did the vfork/compiler bug occur?  */
  1761. X     || parent != getpid()
  1762. X
  1763. X     /* Did the signal handling bug occur?  */
  1764. X     || kill(parent, SIGINT) != 0
  1765. X     || signalled != 1
  1766. X
  1767. X     /* Did the file descriptor bug occur?  */
  1768. X     || fstat(fileno(stdout), &st) != 0
  1769. X     );
  1770. X  }
  1771. }
  1772. EOF
  1773. eval $ac_link
  1774. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1775. X  ac_cv_func_vfork=yes
  1776. else
  1777. X  ac_cv_func_vfork=no
  1778. fi
  1779. fi
  1780. rm -fr conftest*
  1781. fi
  1782. echo "$ac_t""$ac_cv_func_vfork" 1>&4
  1783. if test $ac_cv_func_vfork = no; then
  1784. X  cat >> confdefs.h <<\EOF
  1785. #define vfork fork
  1786. EOF
  1787. X
  1788. fi
  1789. X
  1790. echo $ac_n "checking for vprintf""... $ac_c" 1>&4
  1791. if eval "test \"`echo '${'ac_cv_func_vprintf'+set}'`\" = set"; then
  1792. X  echo $ac_n "(cached) $ac_c" 1>&4
  1793. else
  1794. X  cat > conftest.$ac_ext <<EOF
  1795. #line 1524 "configure"
  1796. #include "confdefs.h"
  1797. #include <ctype.h> /* Arbitrary system header to define __stub macros. */
  1798. /* Override any gcc2 internal prototype to avoid an error.  */
  1799. char vprintf(); 
  1800. X
  1801. int main() { return 0; }
  1802. int t() {
  1803. X
  1804. /* The GNU C library defines this for functions which it implements
  1805. X    to always fail with ENOSYS.  Some functions are actually named
  1806. X    something starting with __ and the normal name is an alias.  */
  1807. #if defined (__stub_vprintf) || defined (__stub___vprintf)
  1808. choke me
  1809. #else
  1810. vprintf();
  1811. #endif
  1812. X
  1813. ; return 0; }
  1814. EOF
  1815. if eval $ac_link; then
  1816. X  rm -rf conftest*
  1817. X  eval "ac_cv_func_vprintf=yes"
  1818. else
  1819. X  rm -rf conftest*
  1820. X  eval "ac_cv_func_vprintf=no"
  1821. fi
  1822. rm -f conftest*
  1823. X
  1824. fi
  1825. if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then
  1826. X  echo "$ac_t""yes" 1>&4
  1827. X  cat >> confdefs.h <<\EOF
  1828. #define HAVE_VPRINTF 1
  1829. EOF
  1830. X
  1831. else
  1832. X  echo "$ac_t""no" 1>&4
  1833. fi
  1834. X
  1835. if test "$ac_cv_func_vprintf" != yes; then
  1836. echo $ac_n "checking for _doprnt""... $ac_c" 1>&4
  1837. if eval "test \"`echo '${'ac_cv_func__doprnt'+set}'`\" = set"; then
  1838. X  echo $ac_n "(cached) $ac_c" 1>&4
  1839. else
  1840. X  cat > conftest.$ac_ext <<EOF
  1841. #line 1570 "configure"
  1842. #include "confdefs.h"
  1843. #include <ctype.h> /* Arbitrary system header to define __stub macros. */
  1844. /* Override any gcc2 internal prototype to avoid an error.  */
  1845. char _doprnt(); 
  1846. X
  1847. int main() { return 0; }
  1848. int t() {
  1849. X
  1850. /* The GNU C library defines this for functions which it implements
  1851. X    to always fail with ENOSYS.  Some functions are actually named
  1852. X    something starting with __ and the normal name is an alias.  */
  1853. #if defined (__stub__doprnt) || defined (__stub____doprnt)
  1854. choke me
  1855. #else
  1856. _doprnt();
  1857. #endif
  1858. X
  1859. ; return 0; }
  1860. EOF
  1861. if eval $ac_link; then
  1862. X  rm -rf conftest*
  1863. X  eval "ac_cv_func__doprnt=yes"
  1864. else
  1865. X  rm -rf conftest*
  1866. X  eval "ac_cv_func__doprnt=no"
  1867. fi
  1868. rm -f conftest*
  1869. X
  1870. fi
  1871. if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then
  1872. X  echo "$ac_t""yes" 1>&4
  1873. X  cat >> confdefs.h <<\EOF
  1874. #define HAVE_DOPRNT 1
  1875. EOF
  1876. X
  1877. else
  1878. X  echo "$ac_t""no" 1>&4
  1879. fi
  1880. X
  1881. fi
  1882. X
  1883. X
  1884. trap '' 1 2 15
  1885. if test -w $cache_file; then
  1886. echo "updating cache $cache_file"
  1887. cat > $cache_file <<\EOF
  1888. # This file is a shell script that caches the results of configure
  1889. # tests run on this system so they can be shared between configure
  1890. # scripts and configure runs.  It is not useful on other systems.
  1891. # If it contains results you don't want to keep, you may remove or edit it.
  1892. #
  1893. # By default, configure uses ./config.cache as the cache file,
  1894. # creating it if it does not exist already.  You can give configure
  1895. # the --cache-file=FILE option to use a different cache file; that is
  1896. # what configure does when it calls configure scripts in
  1897. # subdirectories, so they share the cache.
  1898. # Giving --cache-file=/dev/null disables caching, for debugging configure.
  1899. # config.status only pays attention to the cache file if you give it the
  1900. # --recheck option to rerun configure.
  1901. #
  1902. EOF
  1903. # Ultrix sh set writes to stderr and can't be redirected directly.
  1904. (set) 2>&1 |
  1905. X  sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/: \${\1='\2'}/p" \
  1906. X  >> $cache_file
  1907. else
  1908. echo "not updating unwritable cache $cache_file"
  1909. fi
  1910. X
  1911. trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15
  1912. X
  1913. test "x$prefix" = xNONE && prefix=$ac_default_prefix
  1914. # Let make expand exec_prefix.
  1915. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
  1916. X
  1917. # Any assignment to VPATH causes Sun make to only execute
  1918. # the first set of double-colon rules, so remove it if not needed.
  1919. # If there is a colon in the path, we need to keep it.
  1920. if test "x$srcdir" = x.; then
  1921. X  ac_vpsub='/^[     ]*VPATH[     ]*=[^:]*$/d'
  1922. fi
  1923. X
  1924. trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
  1925. X
  1926. DEFS=-DHAVE_CONFIG_H
  1927. X
  1928. # Without the "./", some shells look in PATH for config.status.
  1929. : ${CONFIG_STATUS=./config.status}
  1930. X
  1931. echo creating $CONFIG_STATUS
  1932. rm -f $CONFIG_STATUS
  1933. cat > $CONFIG_STATUS <<EOF
  1934. #!/bin/sh
  1935. # Generated automatically by configure.
  1936. # Run this file to recreate the current configuration.
  1937. # This directory was configured as follows,
  1938. # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
  1939. #
  1940. # $0 $ac_configure_args
  1941. #
  1942. # Compiler output produced by configure, useful for debugging
  1943. # configure, is in ./config.log if it exists.
  1944. X
  1945. ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
  1946. for ac_option
  1947. do
  1948. X  case "\$ac_option" in
  1949. X  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  1950. X    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
  1951. X    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
  1952. X  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
  1953. X    echo "$CONFIG_STATUS generated by autoconf version 2.1"
  1954. X    exit 0 ;;
  1955. X  -help | --help | --hel | --he | --h)
  1956. X    echo "\$ac_cs_usage"; exit 0 ;;
  1957. X  *) echo "\$ac_cs_usage"; exit 1 ;;
  1958. X  esac
  1959. done
  1960. X
  1961. ac_given_srcdir=$srcdir
  1962. ac_given_INSTALL="$INSTALL"
  1963. X
  1964. trap 'rm -fr Makefile c-auto.h conftest*; exit 1' 1 2 15
  1965. X
  1966. # Protect against being on the right side of a sed subst in config.status. 
  1967. sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g; 
  1968. X s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF
  1969. $ac_vpsub
  1970. $extrasub
  1971. s%@CFLAGS@%$CFLAGS%g
  1972. s%@CPPFLAGS@%$CPPFLAGS%g
  1973. s%@CXXFLAGS@%$CXXFLAGS%g
  1974. s%@DEFS@%$DEFS%g
  1975. s%@LDFLAGS@%$LDFLAGS%g
  1976. s%@LIBS@%$LIBS%g
  1977. s%@exec_prefix@%$exec_prefix%g
  1978. s%@prefix@%$prefix%g
  1979. s%@program_transform_name@%$program_transform_name%g
  1980. s%@SET_MAKE@%$SET_MAKE%g
  1981. s%@CC@%$CC%g
  1982. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  1983. s%@INSTALL_DATA@%$INSTALL_DATA%g
  1984. s%@RANLIB@%$RANLIB%g
  1985. s%@CPP@%$CPP%g
  1986. s%@LIBOBJS@%$LIBOBJS%g
  1987. X
  1988. CEOF
  1989. EOF
  1990. cat >> $CONFIG_STATUS <<EOF
  1991. X
  1992. CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
  1993. EOF
  1994. cat >> $CONFIG_STATUS <<\EOF
  1995. for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
  1996. X  # Support "outfile[:infile]", defaulting infile="outfile.in".
  1997. X  case "$ac_file" in
  1998. X  *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
  1999. X       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
  2000. X  *) ac_file_in="${ac_file}.in" ;;
  2001. X  esac
  2002. X
  2003. X  # Adjust relative srcdir, etc. for subdirectories.
  2004. X
  2005. X  # Remove last slash and all that follows it.  Not all systems have dirname.
  2006. X  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
  2007. X  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
  2008. X    # The file is in a subdirectory.
  2009. X    test ! -d "$ac_dir" && mkdir "$ac_dir"
  2010. X    ac_dir_suffix="/$ac_dir"
  2011. X    # A "../" for each directory in $ac_dir_suffix.
  2012. X    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
  2013. X  else
  2014. X    ac_dir_suffix= ac_dots=
  2015. X  fi
  2016. X
  2017. X  case "$ac_given_srcdir" in
  2018. X  .)  srcdir=.
  2019. X      if test -z "$ac_dots"; then top_srcdir=.
  2020. X      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
  2021. X  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
  2022. X  *) # Relative path.
  2023. X    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
  2024. X    top_srcdir="$ac_dots$ac_given_srcdir" ;;
  2025. X  esac
  2026. X
  2027. X  case "$ac_given_INSTALL" in
  2028. X  [/$]*) INSTALL="$ac_given_INSTALL" ;;
  2029. X  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
  2030. X  esac
  2031. X  echo creating "$ac_file"
  2032. X  rm -f "$ac_file"
  2033. X  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
  2034. X  case "$ac_file" in
  2035. X  *Makefile*) ac_comsub="1i\\
  2036. # $configure_input" ;;
  2037. X  *) ac_comsub= ;;
  2038. X  esac
  2039. X  # Replace lines of the form ac_include foo with the contents of foo:
  2040. X  # first, from the ac_include lines construct a list of sed
  2041. X  # commands to remove them, and include the files; then run sed.
  2042. X  # Have to use sed because old (Ultrix, SunOS) awk does not support
  2043. X  # getline or system. (Anyway, configure scripts aren't supposed to use awk.)
  2044. X  # Use \@...@<cmd> form of sed address because the filename may contain /.
  2045. X  # Can't use only one -e and commands {dr foo} because foo has to be last.
  2046. X  # Use @e initially instead of -e because GNU echo has a -e option.
  2047. X  # USe `X' to mean a bunch of backslashes; this is for FreeBSD.
  2048. X  file_substs=`sed -n \
  2049. "/^ac_include/s%ac_include[     ]*\(.*\)%@e 'X@^&@r \1' -e 'X@^&@d'%p" \
  2050. X               $ac_given_srcdir/${ac_file}.in`
  2051. X  if test -n "$file_substs"; then
  2052. X    # Change @e back to -e and X@^ to \@^.
  2053. X    file_subst_cmd="sed `echo $file_substs \
  2054. X                         | sed -e 's/@e/-e/g' -e 's/X@^/\\\\\@^/g'`"
  2055. X  else
  2056. X    # If no substitutions and hence no sed commands, don't choke.
  2057. X    file_subst_cmd=cat
  2058. X  fi
  2059. X  # cd into the srcdir because the files being included more or less
  2060. X  # must be part of the distribution. I can't find any way to do
  2061. X  # variable substitution in the sed commands (so the user could have,
  2062. X  # e.g., $top_srcdir in their ac_include line).
  2063. X  (cd $ac_given_srcdir && eval $file_subst_cmd ${ac_file}.in) \
  2064. X  | sed -e "$ac_comsub
  2065. s%@configure_input@%$configure_input%g
  2066. s%@srcdir@%$srcdir%g
  2067. s%@top_srcdir@%$top_srcdir%g
  2068. s%@INSTALL@%$INSTALL%g
  2069. " -f conftest.subs > $ac_file
  2070. fi; done
  2071. rm -f conftest.subs
  2072. X
  2073. # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
  2074. # NAME is the cpp macro being defined and VALUE is the value it is being given.
  2075. #
  2076. # ac_d sets the value in "#define NAME VALUE" lines.
  2077. ac_dA='s%^\([     ]*\)#\([     ]*define[     ][     ]*\)'
  2078. ac_dB='\([     ][     ]*\)[^     ]*%\1#\2'
  2079. ac_dC='\3'
  2080. ac_dD='%g'
  2081. # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
  2082. ac_uA='s%^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  2083. ac_uB='\([     ]\)%\1#\2define\3'
  2084. ac_uC=' '
  2085. ac_uD='\4%g'
  2086. # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
  2087. ac_eA='s%^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  2088. ac_eB='$%\1#\2define\3'
  2089. ac_eC=' '
  2090. ac_eD='%g'
  2091. X
  2092. CONFIG_HEADERS=${CONFIG_HEADERS-"c-auto.h"}
  2093. for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
  2094. X  # Support "outfile[:infile]", defaulting infile="outfile.in".
  2095. X  case "$ac_file" in
  2096. X  *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
  2097. X       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
  2098. X  *) ac_file_in="${ac_file}.in" ;;
  2099. X  esac
  2100. X
  2101. X  echo creating $ac_file
  2102. X
  2103. X  rm -f conftest.frag conftest.in conftest.out
  2104. X  cp $ac_given_srcdir/$ac_file_in conftest.in
  2105. X
  2106. EOF
  2107. X
  2108. # Transform confdefs.h into a sed script conftest.vals that substitutes
  2109. # the proper values into config.h.in to produce config.h.  And first:
  2110. # Protect against being on the right side of a sed subst in config.status. 
  2111. # Protect against being in an unquoted here document in config.status.
  2112. rm -f conftest.vals
  2113. cat > conftest.hdr <<\EOF
  2114. s/[\\&%]/\\&/g
  2115. s%[\\$`]%\\&%g
  2116. s%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
  2117. s%ac_d%ac_u%gp
  2118. s%ac_u%ac_e%gp
  2119. EOF
  2120. sed -n -f conftest.hdr confdefs.h > conftest.vals
  2121. rm -f conftest.hdr
  2122. X
  2123. # This sed command replaces #undef with comments.  This is necessary, for
  2124. # example, in the case of _POSIX_SOURCE, which is predefined and required
  2125. # on some systems where configure will not decide to define it.
  2126. cat >> conftest.vals <<\EOF
  2127. s%^[     ]*#[     ]*undef[     ][     ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
  2128. EOF
  2129. X
  2130. # Break up conftest.vals because some shells have a limit on
  2131. # the size of here documents, and old seds have small limits too.
  2132. # Maximum number of lines to put in a single here document.
  2133. ac_max_here_lines=12
  2134. X
  2135. rm -f conftest.tail
  2136. while :
  2137. do
  2138. X  ac_lines=`grep -c . conftest.vals`
  2139. X  # grep -c gives empty output for an empty file on some AIX systems.
  2140. X  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
  2141. X  # Write a limited-size here document to conftest.frag.
  2142. X  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
  2143. X  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
  2144. X  echo 'CEOF
  2145. X  sed -f conftest.frag conftest.in > conftest.out
  2146. X  rm -f conftest.in
  2147. X  mv conftest.out conftest.in
  2148. ' >> $CONFIG_STATUS
  2149. X  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
  2150. X  rm -f conftest.vals
  2151. X  mv conftest.tail conftest.vals
  2152. done
  2153. rm -f conftest.vals
  2154. X
  2155. cat >> $CONFIG_STATUS <<\EOF
  2156. X  rm -f conftest.frag conftest.h
  2157. X  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
  2158. X  cat conftest.in >> conftest.h
  2159. X  rm -f conftest.in
  2160. X  if cmp -s $ac_file conftest.h 2>/dev/null; then
  2161. X    echo "$ac_file is unchanged"
  2162. X    rm -f conftest.h
  2163. X  else
  2164. X    rm -f $ac_file
  2165. X    mv conftest.h $ac_file
  2166. X  fi
  2167. fi; done
  2168. X
  2169. X
  2170. X
  2171. Xexit 0
  2172. EOF
  2173. chmod +x $CONFIG_STATUS
  2174. rm -fr confdefs* $ac_clean_files
  2175. test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS
  2176. X
  2177. SHAR_EOF
  2178.   $shar_touch -am 0105151395 'gsftopk/configure' &&
  2179.   chmod 0755 'gsftopk/configure' ||
  2180.   echo 'restore of gsftopk/configure failed'
  2181.   shar_count="`wc -c < 'gsftopk/configure'`"
  2182.   test 53177 -eq "$shar_count" ||
  2183.     echo "gsftopk/configure: original size 53177, current size $shar_count"
  2184. fi
  2185. # ============= gsftopk/configure.in ==============
  2186. if test -f 'gsftopk/configure.in' && test X"$1" != X"-c"; then
  2187.   echo 'x - skipping gsftopk/configure.in (file already exists)'
  2188. else
  2189.   echo 'x - extracting gsftopk/configure.in (text)'
  2190.   sed 's/^X//' << 'SHAR_EOF' > 'gsftopk/configure.in' &&
  2191. dnl Process this file with autoconf to produce a configure script.
  2192. AC_INIT(gsftopk.c)
  2193. X
  2194. sinclude(../kpathsea/common.ac)
  2195. X
  2196. dnl Checks for header files.
  2197. AC_HEADER_SYS_WAIT
  2198. X
  2199. dnl Checks for library functions.
  2200. AC_FUNC_MEMCMP
  2201. AC_FUNC_VFORK
  2202. AC_FUNC_VPRINTF
  2203. X
  2204. AC_OUTPUT(Makefile)
  2205. SHAR_EOF
  2206.   $shar_touch -am 1215232794 'gsftopk/configure.in' &&
  2207.   chmod 0644 'gsftopk/configure.in' ||
  2208.   echo 'restore of gsftopk/configure.in failed'
  2209.   shar_count="`wc -c < 'gsftopk/configure.in'`"
  2210.   test 269 -eq "$shar_count" ||
  2211.     echo "gsftopk/configure.in: original size 269, current size $shar_count"
  2212. fi
  2213. # ============= gsftopk/gsftopk.1 ==============
  2214. if test -f 'gsftopk/gsftopk.1' && test X"$1" != X"-c"; then
  2215.   echo 'x - skipping gsftopk/gsftopk.1 (file already exists)'
  2216. else
  2217.   echo 'x - extracting gsftopk/gsftopk.1 (text)'
  2218.   sed 's/^X//' << 'SHAR_EOF' > 'gsftopk/gsftopk.1' &&
  2219. X.\" Copyright (c) 1994 Paul Vojta.  All rights reserved.
  2220. X.\"
  2221. X.\" Redistribution and use in source and binary forms, with or without
  2222. X.\" modification, are permitted provided that the following conditions
  2223. X.\" are met:
  2224. X.\" 1. Redistributions of source code must retain the above copyright
  2225. X.\"    notice, this list of conditions and the following disclaimer.
  2226. X.\" 2. Redistributions in binary form must reproduce the above copyright
  2227. X.\"    notice, this list of conditions and the following disclaimer in the
  2228. X.\"    documentation and/or other materials provided with the distribution.
  2229. X.\"
  2230. X.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  2231. X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  2232. X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  2233. X.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  2234. X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  2235. X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  2236. X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  2237. X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  2238. X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  2239. X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  2240. X.\" SUCH DAMAGE.
  2241. X.\"
  2242. X.TH GSFTOPK 1 "29 July 1994"
  2243. X.SH NAME
  2244. gsftopk \- render a ghostscript font in TeX pk format
  2245. X.SH SYNOPSIS
  2246. \fBgsftopk\fP [\fB\-q\fP] \fIfont\fP \fIdpi\fP
  2247. X.SH ARGUMENTS
  2248. X.IP \fIfont\fP \w'\fIfont\fP'u+2m
  2249. Name of the font to be created.
  2250. X.IP \fIdpi\fP
  2251. Desired resolution of the font to be created, in dots per inch.  This may
  2252. be a real number.
  2253. X.SH DESCRIPTION
  2254. X.B gsftopk
  2255. is a program which calls up the ghostscript program
  2256. X.BR gs (1)
  2257. to render a given font at a given resolution.  It packs the resulting
  2258. characters into the
  2259. X.B pk
  2260. file format and writes them to a file whose name is formed from the font
  2261. name and the resolution (rounded to the nearest integer).
  2262. X.PP
  2263. This program should normally be called by a script, such as
  2264. X.BR xdvimakepk ,
  2265. to create fonts on demand.
  2266. X.PP
  2267. X.B gsftopk
  2268. obtains the character widths from the
  2269. X.RI . tfm
  2270. file, which must exist in the standard search path.  It also must be
  2271. able to find a file
  2272. X.B psfonts.map
  2273. (formatted as in
  2274. X.BR dvips (1)),
  2275. listing the available fonts.
  2276. X.SH OPTIONS
  2277. X.TP
  2278. X.B \-q
  2279. Operate quietly;
  2280. X.I i.e.,
  2281. without writing any messages to the standard output.
  2282. X.SH ENVIRONMENT VARIABLES
  2283. X.IP \fBTEXFONTS\fP \w'\fBDVIPSHEADERS\fP'u+2m
  2284. Colon-separated list of directories to search for the
  2285. X.RI . tfm
  2286. file associated with the font.  An extra colon in the list will include the
  2287. system default path at that point.  A double slash will enable recursive
  2288. subdirectory searching at that point in the path.
  2289. X.IP \fBDVIPSHEADERS\fP
  2290. Colon-separated list of directories to search for the ghostscript
  2291. driver file
  2292. X.B render.ps
  2293. and for any PostScript font files
  2294. X.RI (. pfa
  2295. or
  2296. X.RI . pfb
  2297. files).  An extra colon in the list behaves as with
  2298. X.SB TEXFONTS.
  2299. X.IP \fBTEXCONFIG\fP
  2300. Path to search for the file
  2301. X.BR psfonts.map .
  2302. Only the first such file will be used.
  2303. X.SH BUGS
  2304. X.B gsftopk
  2305. sometimes has trouble with fonts with very complicated characters
  2306. (such as the Seal of the University of California).  This is because
  2307. X.B gsftopk
  2308. uses the
  2309. X.B charpath
  2310. operator to determine the bounding box of each character.  If the character
  2311. is too complicated, then it will exceed the allowable length of a path;
  2312. this causes
  2313. X.B gsftopk
  2314. to terminate with an error message
  2315. X.IP
  2316. X.B "Call to gs stopped by signal 10"
  2317. X.LP
  2318. (The number may vary from system to system; it corresponds to a bus error
  2319. or a segmentation fault.)  This is actually a design limitation in PostScript,
  2320. exacerbated by a bug in
  2321. X.BR ghostscript ,
  2322. rather than a bug in
  2323. X.B gsftopk
  2324. itself.  To work around this bug,
  2325. X.B gsftopk
  2326. can be instructed to use the bounding box provided with the font (if one
  2327. exists) instead of finding a bounding box for each character.  To do this,
  2328. include the string
  2329. X.IP
  2330. X.B /usefontbbox true def
  2331. X.LP
  2332. in the
  2333. X.B psfonts.map
  2334. file;
  2335. X.IR e.g. ,
  2336. X.IP
  2337. X.B ucseal """/usefontbbox true def"""
  2338. X.LP
  2339. This will not affect use of the font by
  2340. X.BR dvips .
  2341. X.SH SEE ALSO
  2342. X.BR gs (1),
  2343. X.BR gftopk (1),
  2344. X.BR tex (1),
  2345. X.BR xdvi (1),
  2346. X.BR dvips (1)
  2347. X.SH AUTHOR
  2348. Written by Paul Vojta.  This program was inspired by
  2349. X.BR gsrenderfont ,
  2350. which was written by Karl Berry.
  2351. SHAR_EOF
  2352.   $shar_touch -am 0729000394 'gsftopk/gsftopk.1' &&
  2353.   chmod 0644 'gsftopk/gsftopk.1' ||
  2354.   echo 'restore of gsftopk/gsftopk.1 failed'
  2355.   shar_count="`wc -c < 'gsftopk/gsftopk.1'`"
  2356.   test 4386 -eq "$shar_count" ||
  2357.     echo "gsftopk/gsftopk.1: original size 4386, current size $shar_count"
  2358. fi
  2359. # ============= gsftopk/gsftopk.c ==============
  2360. if test -f 'gsftopk/gsftopk.c' && test X"$1" != X"-c"; then
  2361.   echo 'x - skipping gsftopk/gsftopk.c (file already exists)'
  2362. else
  2363.   echo 'x - extracting gsftopk/gsftopk.c (text)'
  2364.   sed 's/^X//' << 'SHAR_EOF' > 'gsftopk/gsftopk.c' &&
  2365. /*
  2366. X * Copyright (c) 1994 Paul Vojta.  All rights reserved.
  2367. X *
  2368. X * Redistribution and use in source and binary forms, with or without
  2369. X * modification, are permitted provided that the following conditions
  2370. X * are met:
  2371. X * 1. Redistributions of source code must retain the above copyright
  2372. X *    notice, this list of conditions and the following disclaimer.
  2373. X * 2. Redistributions in binary form must reproduce the above copyright
  2374. X *    notice, this list of conditions and the following disclaimer in the
  2375. X *    documentation and/or other materials provided with the distribution.
  2376. X *
  2377. X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  2378. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  2379. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  2380. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  2381. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  2382. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  2383. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  2384. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  2385. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  2386. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  2387. X * SUCH DAMAGE.
  2388. X */
  2389. X
  2390. /*
  2391. X * Okt, 1994: Thomas Esser (te@informatik.uni-hannover.de)
  2392. X * ported to use kpathsea library from Karl Berry (Version 2.1)
  2393. X * 
  2394. X * THIS VERSION IS ONLY TESTED UNDER LINUX BY NOW!
  2395. X * 
  2396. X * Please direct bug-reports to me and *NOT* to Paul Vojta.
  2397. X * I will check, whether your problem applies to the original version
  2398. X * as well and in that case contact the author.
  2399. X */
  2400. X
  2401. #ifndef    lint
  2402. static    char    copyright[] =
  2403. "@(#) Copyright (c) 1994 Paul Vojta.  All rights reserved.\n";
  2404. #endif
  2405. X
  2406. #include <c-auto.h>
  2407. #include <errno.h>
  2408. #include <ctype.h>
  2409. #include <sys/types.h>
  2410. #include <sys/wait.h>
  2411. #include <sys/stat.h>
  2412. #include <setjmp.h>
  2413. /* The stuff from the path searching library.  */
  2414. #include <kpathsea/c-std.h>
  2415. #include <kpathsea/tex-file.h>
  2416. X
  2417. #ifndef    GS
  2418. #define    GS    "gs"
  2419. #endif
  2420. X
  2421. #ifndef    atof
  2422. double    atof();
  2423. #endif
  2424. char    *getenv();
  2425. X
  2426. #ifdef    __GNUC__
  2427. #define    NORETURN    volatile
  2428. #else
  2429. #define    NORETURN    /* nothing */
  2430. #endif
  2431. X
  2432. #ifdef    STDC_HEADERS
  2433. #define    NeedVarargsPrototypes    1
  2434. #include <stdarg.h>
  2435. #else
  2436. #define    NeedVarargsPrototypes    0
  2437. #include <varargs.h>
  2438. #endif
  2439. X
  2440. typedef    char    Boolean;
  2441. #define    True    1
  2442. #define    False    0
  2443. X
  2444. #ifndef    MAXPATHLEN
  2445. #define    MAXPATHLEN    256
  2446. #endif
  2447. X
  2448. #define    PK_PRE    (char) 247
  2449. #define    PK_ID    89
  2450. #define    PK_POST    (char) 245
  2451. #define    PK_NOP    (char) 246
  2452. X
  2453. char    ident[]    = "gsftopk version 1.7";
  2454. X
  2455. typedef    unsigned char    byte;
  2456. X
  2457. FILE        *data_file;
  2458. FILE        *pk_file;
  2459. Boolean        quiet        = False;
  2460. int        col        = 0;        /* current column number */
  2461. X
  2462. /*
  2463. X *    Information from the .tfm file.
  2464. X */
  2465. X
  2466. int        tfm_lengths[12];
  2467. #define    lh    tfm_lengths[1]
  2468. #define    bc    tfm_lengths[2]
  2469. #define    ec    tfm_lengths[3]
  2470. #define    nw    tfm_lengths[4]
  2471. X
  2472. long        checksum;
  2473. long        design;
  2474. byte        width_index[256];
  2475. long        tfm_widths[256];
  2476. X
  2477. /*
  2478. X *    Information on the bitmap currently being worked on.
  2479. X */
  2480. X
  2481. byte        *bitmap;
  2482. int        width;
  2483. int        skip;
  2484. int        height;
  2485. int        hoff;
  2486. int        voff;
  2487. int        bytes_wide;
  2488. unsigned int    bm_size;
  2489. byte        *bitmap_end;
  2490. int        pk_len;
  2491. X
  2492. /*
  2493. X *    Print error message and quit.
  2494. X */
  2495. X
  2496. #if    NeedVarargsPrototypes
  2497. NORETURN void
  2498. oops(const char *message, ...)
  2499. #else
  2500. /* VARARGS */
  2501. NORETURN void
  2502. oops(va_alist)
  2503. X    va_dcl
  2504. #endif
  2505. {
  2506. #if    !NeedVarargsPrototypes
  2507. X    const char *message;
  2508. #endif
  2509. X    va_list    args;
  2510. X
  2511. #if    NeedVarargsPrototypes
  2512. X    va_start(args, message);
  2513. #else
  2514. X    va_start(args);
  2515. X    message = va_arg(args, const char *);
  2516. #endif
  2517. X    vfprintf(stderr, message, args);
  2518. X    va_end(args);
  2519. X    putc('\n', stderr);
  2520. X    exit(1);
  2521. }
  2522. X
  2523. /*
  2524. X *    Either allocate storage or fail with explanation.
  2525. X */
  2526. X
  2527. char *
  2528. xmalloc(size, why)
  2529. X    unsigned    size;
  2530. X    const char    *why;
  2531. {
  2532. X    char *mem = (char *) malloc(size);
  2533. X
  2534. X    if (mem == NULL)
  2535. X        oops("Cannot allocate %u bytes for %s.\n", size, why);
  2536. X    return mem;
  2537. }
  2538. X
  2539. /*
  2540. X *    Either reallocate storage or fail with explanation.
  2541. X */
  2542. X
  2543. char *
  2544. xrealloc(oldp, size, why)
  2545. X    char        *oldp;
  2546. X    unsigned    size;
  2547. X    const char    *why;
  2548. {
  2549. X    char    *mem;
  2550. X
  2551. X    mem = oldp == NULL ? (char *) malloc(size)
  2552. X        : (char *) realloc(oldp, size);
  2553. X    if (mem == NULL)
  2554. X        oops("Cannot reallocate %u bytes for %s.\n", size, why);
  2555. X    return mem;
  2556. }
  2557. X
  2558. /*
  2559. X *    Here's the patch searching stuff.  First the typedefs and variables.
  2560. X */
  2561. X
  2562. static    char    searchpath[MAXPATHLEN + 1];
  2563. X
  2564. #define    HUNKSIZE    (MAXPATHLEN + 2)
  2565. X
  2566. struct spacenode {    /* used for storage of directory names */
  2567. X    struct spacenode    *next;
  2568. X    char            *sp_end;    /* end of data for this chunk */
  2569. X    char            sp[HUNKSIZE];
  2570. }
  2571. X    firstnode;
  2572. X
  2573. static    jmp_buf    found_env;
  2574. static    FILE    *searchfile;
  2575. static    char    *searchname;
  2576. static    int    searchnamelen;
  2577. X
  2578. /*
  2579. X *    Add to dlstring
  2580. X */
  2581. X
  2582. char        *dlstring    = NULL;
  2583. unsigned int    dls_len        = 0;
  2584. unsigned int    dls_max        = 0;
  2585. X
  2586. void
  2587. addtodls(char *s)
  2588. {
  2589. X    int    len    = strlen(s);
  2590. X
  2591. X    if (dls_len + len >= dls_max) {
  2592. X        unsigned int newsize = dls_max + 80;
  2593. X
  2594. X        if (newsize <= dls_len + len) newsize = dls_len + len + 1;
  2595. X        dlstring = xrealloc(dlstring, dls_max = newsize, "download string");
  2596. X    }
  2597. X    strcpy(dlstring + dls_len, s);
  2598. X    dls_len += len;
  2599. }
  2600. X
  2601. X
  2602. X
  2603. long
  2604. getlong(FILE *f)
  2605. {
  2606. X    int    value;
  2607. X
  2608. X    value = (int) ((byte) getc(f)) << 24;
  2609. X    value |= (int) ((byte) getc(f)) << 16;
  2610. X    value |= (int) ((byte) getc(f)) << 8;
  2611. X    value |= (int) ((byte) getc(f));
  2612. X    return value;
  2613. }
  2614. X
  2615. X
  2616. char    line[82];
  2617. X
  2618. void
  2619. expect(char *waitingfor)
  2620. {
  2621. X    for (;;) {
  2622. X        if (fgets(line, sizeof(line), data_file) == NULL)
  2623. X        oops("Premature end of file");
  2624. X        if (memcmp(line, waitingfor, strlen(waitingfor)) == 0) return;
  2625. X        fputs("gs: ", stdout);
  2626. X        for (;;) {
  2627. X        fputs(line, stdout);
  2628. X        if (*line == '\0' || line[strlen(line) - 1] == '\n') break;
  2629. X        if (fgets(line, sizeof(line), data_file) == NULL)
  2630. X            oops("Premature end of file");
  2631. X        }
  2632. X    }
  2633. }
  2634. X
  2635. void
  2636. whitespace(void)
  2637. {
  2638. X    char    c    = getc(data_file);
  2639. X
  2640. X    if (!isspace(c) && c != '#')
  2641. X        oops("white space expected");
  2642. X    for (;;) {
  2643. X        if (c == '#')
  2644. X        do c = getc(data_file); while (!feof(data_file) && c != '\n');
  2645. X        else if (!isspace(c)) {
  2646. X        ungetc(c, data_file);
  2647. X        break;
  2648. X        }
  2649. X        c = getc(data_file);
  2650. X    }
  2651. }
  2652. X
  2653. int
  2654. getint(void)
  2655. {
  2656. X    char    c;
  2657. X    int    i    = 0;
  2658. X
  2659. X    do c = getc(data_file); while (isspace(c));
  2660. X    if (c < '0' || c > '9') oops("digit expected");
  2661. X    do {
  2662. X        i = i * 10 + (c - '0');
  2663. X        c = getc(data_file);
  2664. X    } while (c >= '0' && c <= '9');
  2665. X    if (!feof(data_file)) ungetc(c, data_file);
  2666. X    return i;
  2667. }
  2668. X
  2669. static    byte    masks[]    = {0, 1, 3, 7, 017, 037, 077, 0177, 0377};
  2670. X
  2671. byte    flag;
  2672. int    pk_dyn_f;
  2673. int    pk_dyn_g;
  2674. int    base;        /* cost of this character if pk_dyn_f = 0 */
  2675. int    deltas[13];    /* cost of increasing pk_dyn_f from i to i+1 */
  2676. X
  2677. /*
  2678. X *    Add up statistics for putting out the given shift count
  2679. X */
  2680. X
  2681. static    void
  2682. tallyup(int n)
  2683. {
  2684. X    int    m;
  2685. X
  2686. X    if (n > 208) {
  2687. X        ++base;
  2688. X        n -= 192;
  2689. X        for (m = 0x100; m != 0 && m < n; m <<= 4) base += 2;
  2690. X        if (m != 0 && (m = (m - n) / 15) < 13) deltas[m] += 2;
  2691. X    }
  2692. X    else if (n > 13) ++deltas[(208 - n) / 15];
  2693. X    else --deltas[n - 1];
  2694. }
  2695. X
  2696. /*
  2697. X *    Routines for storing the shift counts
  2698. X */
  2699. X
  2700. static    Boolean    odd    = False;
  2701. static    byte    part;
  2702. X
  2703. static    void
  2704. pk_put_nyb(int n)
  2705. {
  2706. X    if (odd) {
  2707. X        *bitmap_end++ = (part << 4) | n;
  2708. X        odd = False;
  2709. X    }
  2710. X    else {
  2711. X        part = n;
  2712. X        odd = True;
  2713. X    }
  2714. }
  2715. X
  2716. static    void
  2717. pk_put_long(int n)
  2718. {
  2719. X    if (n >= 16) {
  2720. X        pk_put_nyb(0);
  2721. X        pk_put_long(n / 16);
  2722. X    }
  2723. X    pk_put_nyb(n % 16);
  2724. }
  2725. X
  2726. static    void
  2727. pk_put_count(int n)
  2728. {
  2729. X    if (n > pk_dyn_f) {
  2730. X        if (n > pk_dyn_g)
  2731. X        pk_put_long(n - pk_dyn_g + 15);
  2732. X        else {
  2733. X        pk_put_nyb(pk_dyn_f + (n - pk_dyn_f + 15) / 16);
  2734. X        pk_put_nyb((n - pk_dyn_f - 1) % 16);
  2735. X        }
  2736. X    }
  2737. X    else pk_put_nyb(n);
  2738. }
  2739. X
  2740. static    void
  2741. trim_bitmap(void)
  2742. {
  2743. X    byte    *p;
  2744. X    byte    mask;
  2745. X
  2746. X    /* clear out garbage bits in bitmap */
  2747. X    if (width % 8 != 0) {
  2748. X        mask = ~masks[8 - width % 8];
  2749. X        for (p = bitmap + bytes_wide - 1; p < bitmap_end; p += bytes_wide)
  2750. X        *p &= mask;
  2751. X    }
  2752. X
  2753. X    /*
  2754. X     *    Find the bounding box of the bitmap.
  2755. X     */
  2756. X
  2757. X    /* trim top */
  2758. X    skip = 0;
  2759. X    mask = 0;
  2760. X    for (;;) {
  2761. X        if (bitmap >= bitmap_end) {    /* if bitmap is empty */
  2762. X        width = height = hoff = voff = 0;
  2763. X        return;
  2764. X        }
  2765. X        p = bitmap + bytes_wide;
  2766. X        while (p > bitmap) mask |= *--p;
  2767. X        if (mask) break;
  2768. X        ++skip;
  2769. X        bitmap += bytes_wide;
  2770. X    }
  2771. X    height -= skip;
  2772. X    voff -= skip;
  2773. #ifdef    DEBUG
  2774. X    if (skip < 2 || skip > 3)
  2775. X        printf("Character has %d empty rows at top\n", skip);
  2776. #endif
  2777. X
  2778. X    /* trim bottom */
  2779. X    skip = 0;
  2780. X    mask = 0;
  2781. X    for (;;) {
  2782. X        p = bitmap_end - bytes_wide;
  2783. X        while (p < bitmap_end) mask |= *p++;
  2784. X        if (mask) break;
  2785. X        ++skip;
  2786. X        bitmap_end -= bytes_wide;
  2787. X    }
  2788. X    height -= skip;
  2789. #ifdef    DEBUG
  2790. X    if (skip < 2 || skip > 3)
  2791. X        printf("Character has %d empty rows at bottom\n", skip);
  2792. #endif
  2793. X
  2794. X    /* trim right */
  2795. X    skip = 0;
  2796. X    --width;
  2797. X    for (;;) {
  2798. X        mask = 0;
  2799. X        for (p = bitmap + width / 8; p < bitmap_end; p += bytes_wide)
  2800. X        mask |= *p;
  2801. X        if (mask & (0x80 >> (width % 8))) break;
  2802. X        --width;
  2803. X        ++skip;
  2804. X    }
  2805. X    ++width;
  2806. #ifdef    DEBUG
  2807. X    if (skip < 2 || skip > 3)
  2808. X        printf("Character has %d empty columns at right\n", skip);
  2809. #endif
  2810. X
  2811. X    /* trim left */
  2812. X    skip = 0;
  2813. X    for (;;) {
  2814. X        mask = 0;
  2815. X        for (p = bitmap + skip / 8; p < bitmap_end; p += bytes_wide)
  2816. X        mask |= *p;
  2817. X        if (mask & (0x80 >> (skip % 8))) break;
  2818. X        ++skip;
  2819. X    }
  2820. X    width -= skip;
  2821. X    hoff -= skip;
  2822. #ifdef    DEBUG
  2823. X    if (skip < 2 || skip > 3)
  2824. X        printf("Character has %d empty columns at left\n", skip);
  2825. #endif
  2826. X    bitmap += skip / 8;
  2827. X    skip = skip % 8;
  2828. }
  2829. X
  2830. /*
  2831. X *    Pack the bitmap using the rll method.  (Return false if it's better
  2832. X *    to just pack the bits.)
  2833. X */
  2834. X
  2835. static    Boolean
  2836. pk_rll_cvt(void)
  2837. {
  2838. X    static    int    *counts        = NULL;    /* area for saving bit counts */
  2839. X    static    int    maxcounts    = 0;    /* size of this area */
  2840. X    unsigned int    ncounts;        /* max to allow this time */
  2841. X    int    *nextcount;            /* next count value */
  2842. X    int    *counts_end;            /* pointer to end */
  2843. X    byte    *rowptr;
  2844. X    byte    *p;
  2845. X    byte    mask;
  2846. X    byte    *rowdup;            /* last row checked for dup */
  2847. X    byte    paint_switch;            /* 0 or 0xff */
  2848. X    int    bits_left;            /* bits left in row */
  2849. X    int    cost;
  2850. X    int    i;
  2851. X
  2852. X    /*
  2853. X     *    Allocate space for bit counts.
  2854. X     */
  2855. X
  2856. X    ncounts = (width * height + 3) / 4;
  2857. X    if (ncounts > maxcounts) {
  2858. X        if (counts != NULL) free(counts);
  2859. X        counts = (int *) xmalloc((ncounts + 2) * sizeof(int),
  2860. X        "array for bit counts");
  2861. X        maxcounts = ncounts;
  2862. X    }
  2863. X    counts_end = counts + ncounts;
  2864. X
  2865. X    /*
  2866. X     *    Form bit counts and collect statistics
  2867. X     */
  2868. X    base = 0;
  2869. X    bzero(deltas, sizeof(deltas));
  2870. X    rowdup = NULL;    /* last row checked for duplicates */
  2871. X    p = rowptr = bitmap;
  2872. X    mask = 0x80 >> skip;
  2873. X    flag = 0;
  2874. X    paint_switch = 0;
  2875. X    if (*p & mask) {
  2876. X        flag = 8;
  2877. X        paint_switch = 0xff;
  2878. X    }
  2879. X    bits_left = width;
  2880. X    nextcount = counts;
  2881. X    while (rowptr < bitmap_end) {    /* loop over shift counts */
  2882. X        int shift_count = bits_left;
  2883. X
  2884. X        for (;;) {
  2885. X        if (bits_left == 0) {
  2886. X            if ((p = rowptr += bytes_wide) >= bitmap_end) break;
  2887. X            mask = 0x80 >> skip;
  2888. X            bits_left = width;
  2889. X            shift_count += width;
  2890. X        }
  2891. X        if (((*p ^ paint_switch) & mask) != 0) break;
  2892. X        --bits_left;
  2893. X        mask >>= 1;
  2894. X        if (mask == 0) {
  2895. X            ++p;
  2896. X            while (*p == paint_switch && bits_left >= 8) {
  2897. X            ++p;
  2898. X            bits_left -= 8;
  2899. X            }
  2900. X            mask = 0x80;
  2901. X        }
  2902. X        }
  2903. X        if (nextcount >= counts_end) return False;
  2904. X        shift_count -= bits_left;
  2905. X        *nextcount++ = shift_count;
  2906. X        tallyup(shift_count);
  2907. X        /* check for duplicate rows */
  2908. X        if (rowptr != rowdup && bits_left != width) {
  2909. X        byte    *p1    = rowptr;
  2910. X        byte    *q    = rowptr + bytes_wide;
  2911. X        int    repeat_count;
  2912. X
  2913. X        while (q < bitmap_end && *p1 == *q) ++p1, ++q;
  2914. X        repeat_count = (p1 - rowptr) / bytes_wide;
  2915. X        if (repeat_count > 0) {
  2916. X            *nextcount++ = -repeat_count;
  2917. X            if (repeat_count == 1) --base;
  2918. X            else {
  2919. X            ++base;
  2920. X            tallyup(repeat_count);
  2921. X            }
  2922. X            rowptr += repeat_count * bytes_wide;
  2923. X        }
  2924. X        rowdup = rowptr;
  2925. X        }
  2926. X        paint_switch = ~paint_switch;
  2927. X    }
  2928. X
  2929. #ifdef    DEBUG
  2930. X    /*
  2931. X     *    Dump the bitmap
  2932. X     */
  2933. X
  2934. X    for (p = bitmap; p < bitmap_end; p += bytes_wide) {
  2935. X        byte *p1    = p;
  2936. X        int j;
  2937. X
  2938. X        mask = 0x80 >> skip;
  2939. X        for (j = 0; j < width; ++j) {
  2940. X        putchar(*p1 & mask ? '@' : '.');
  2941. X        if ((mask >>= 1) == 0) mask = 0x80, ++p1;
  2942. X        }
  2943. X        putchar('\n');
  2944. X    }
  2945. X    putchar('\n');
  2946. #endif
  2947. X
  2948. X    /*
  2949. X     *    Determine the best pk_dyn_f
  2950. X     */
  2951. X
  2952. X    pk_dyn_f = 0;
  2953. X    cost = base += 2 * (nextcount - counts);
  2954. X    for (i = 1; i < 14; ++i) {
  2955. X        base += deltas[i - 1];
  2956. X        if (base < cost) {
  2957. X        pk_dyn_f = i;
  2958. X        cost = base;
  2959. X        }
  2960. X    }
  2961. X    /* last chance to bail out */
  2962. X    if (cost * 4 > width * height) return False;
  2963. X
  2964. X    /*
  2965. X     *    Pack the bit counts
  2966. X     */
  2967. X
  2968. X    pk_dyn_g = 208 - 15 * pk_dyn_f;
  2969. X    flag |= pk_dyn_f << 4;
  2970. X    bitmap_end = bitmap;
  2971. X    *nextcount = 0;
  2972. X    nextcount = counts;
  2973. X    while (*nextcount != 0) {
  2974. X        if (*nextcount > 0) pk_put_count(*nextcount);
  2975. X        else
  2976. X        if (*nextcount == -1) pk_put_nyb(15);
  2977. X        else {
  2978. X            pk_put_nyb(14);
  2979. X            pk_put_count(-*nextcount);
  2980. X        }
  2981. X        ++nextcount;
  2982. X    }
  2983. X    if (odd) {
  2984. X        pk_put_nyb(0);
  2985. X        ++cost;
  2986. X    }
  2987. X    if (cost != 2 * (bitmap_end - bitmap))
  2988. X        printf("Cost miscalculation:  expected %d, got %d\n", cost,
  2989. X        2 * (bitmap_end - bitmap));
  2990. X    pk_len = bitmap_end - bitmap;
  2991. X    return True;
  2992. }
  2993. X
  2994. static    void
  2995. pk_bm_cvt(void)
  2996. {
  2997. X    byte    *rowptr;
  2998. X    byte    *p;
  2999. X    int    blib1;        /* bits left in byte */
  3000. X    int    bits_left;    /* bits left in row */
  3001. X    byte    *q;
  3002. X    int    blib2;
  3003. X    byte    nextbyte;
  3004. X
  3005. X    flag = 14 << 4;
  3006. X    q = bitmap;
  3007. X    blib2 = 8;
  3008. X    nextbyte = 0;
  3009. X    for (rowptr = bitmap; rowptr < bitmap_end; rowptr += bytes_wide) {
  3010. X        p = rowptr;
  3011. X        blib1 = 8 - skip;
  3012. X        bits_left = width;
  3013. X        if (blib2 != 8) {
  3014. X        int    n;
  3015. X
  3016. X        if (blib1 < blib2) {
  3017. X            nextbyte |= *p << (blib2 - blib1);
  3018. X            n = blib1;
  3019. X        }
  3020. X        else {
  3021. X            nextbyte |= *p >> (blib1 - blib2);
  3022. X            n = blib2;
  3023. X        }
  3024. X        blib2 -= n;
  3025. X        if ((bits_left -= n) < 0) {
  3026. X            blib2 -= bits_left;
  3027. X            continue;
  3028. X        }
  3029. X        if ((blib1 -= n) == 0) {
  3030. X            blib1 = 8;
  3031. X            ++p;
  3032. X            if (blib2 > 0) {
  3033. X            nextbyte |= *p >> (8 - blib2);
  3034. X            blib1 -= blib2;
  3035. X            bits_left -= blib2;
  3036. X            if (bits_left < 0) {
  3037. X                blib2 = -bits_left;
  3038. X                continue;
  3039. X            }
  3040. X            }
  3041. X        }
  3042. X        *q++ = nextbyte;
  3043. X        }
  3044. X        /* fill up whole (destination) bytes */
  3045. X        while (bits_left >= 8) {
  3046. X        nextbyte = *p++ << (8 - blib1);
  3047. X        *q++ = nextbyte | (*p >> blib1);
  3048. X        bits_left -= 8;
  3049. X        }
  3050. X        /* now do the remainder */
  3051. X        nextbyte = *p << (8 - blib1);
  3052. X        if (bits_left > blib1) nextbyte |= p[1] >> blib1;
  3053. X        blib2 = 8 - bits_left;
  3054. X    }
  3055. X    if (blib2 != 8) *q++ = nextbyte;
  3056. X    pk_len = q - bitmap;
  3057. }
  3058. X
  3059. static    void
  3060. putshort(short w)
  3061. {
  3062. X    putc(w >> 8, pk_file);
  3063. X    putc(w, pk_file);
  3064. }
  3065. X
  3066. static    void
  3067. putmed(long w)
  3068. {
  3069. X    putc(w >> 16, pk_file);
  3070. X    putc(w >> 8, pk_file);
  3071. X    putc(w, pk_file);
  3072. }
  3073. X
  3074. static    void
  3075. putlong(long w)
  3076. {
  3077. X    putc(w >> 24, pk_file);
  3078. X    putc(w >> 16, pk_file);
  3079. X    putc(w >> 8, pk_file);
  3080. X    putc(w, pk_file);
  3081. }
  3082. X
  3083. static    void
  3084. putglyph(int cc)
  3085. {
  3086. X    static    Boolean    have_first_line = False;
  3087. X    static    int    llx, lly, urx, ury;
  3088. X    static    float    char_width;
  3089. X    static    byte    *area1    = NULL;
  3090. X    static unsigned int size1 = 0;
  3091. X    long    dm;
  3092. X    long    tfm_wid;
  3093. X    byte    *p;
  3094. X    int    i;
  3095. X
  3096. X    if (!quiet) {
  3097. X        int wid;
  3098. X        static char *s = "";
  3099. X
  3100. X        wid = (cc >= 100) + (cc >= 10) + 4;
  3101. X        if (col + wid > 80) {
  3102. X        s = "\n";
  3103. X        col = 0;
  3104. X        }
  3105. X        printf("%s[%d", s, cc);
  3106. X        fflush(stdout);
  3107. X        col += wid;
  3108. X        s = " ";
  3109. X    }
  3110. X    if (!have_first_line) {
  3111. X        expect("#^");
  3112. X        if (sscanf(line, "#^ %d %d %d %d %d %f\n", &i,
  3113. X            &llx, &lly, &urx, &ury, &char_width) != 6)
  3114. X        oops("Cannot scanf first line");
  3115. X    }
  3116. X    if (i < cc) oops("Character %d received, %d expected", i, cc);
  3117. X    if (i > cc) {
  3118. X        fprintf(stderr, "Character %d is missing.\n", cc);
  3119. X        have_first_line = True;
  3120. X        return;
  3121. X    }
  3122. X    have_first_line = False;
  3123. X    hoff = -llx + 2;
  3124. X    voff = ury + 2 - 1;
  3125. X    expect("P4\n");
  3126. X    whitespace();
  3127. X    width = getint();
  3128. X    whitespace();
  3129. X    height = getint();
  3130. X    (void) getc(data_file);
  3131. X    if (width != urx - llx + 4 || height != ury - lly + 4)
  3132. X        oops("Dimensions do not match:  %d %d %d %d %d %d",
  3133. X        llx, lly, urx, ury, width, height);
  3134. X    bytes_wide = (width + 7) / 8;
  3135. X    bm_size = bytes_wide * height;
  3136. X    if (size1 < bm_size) {
  3137. X        if (area1 != NULL) free(area1);
  3138. X        area1 = (byte *) xmalloc(bm_size, "original bitmap");
  3139. X        size1 = bm_size;
  3140. X    }
  3141. X    for (p = area1 + (height - 1) * bytes_wide; p >= area1; p -= bytes_wide)
  3142. X        if (fread(p, 1, bytes_wide, data_file) != bytes_wide)
  3143. X        oops("Cannot read bitmap of size %u", bm_size);
  3144. X    bitmap = area1;
  3145. X    bitmap_end = bitmap + bm_size;
  3146. X    trim_bitmap();
  3147. X    if (height == 0 || !pk_rll_cvt()) pk_bm_cvt();
  3148. X    tfm_wid = tfm_widths[width_index[cc]];
  3149. X    dm = (long) (char_width + 0.5) - (char_width < -0.5);
  3150. X    if (pk_len + 8 < 4 * 256 && tfm_wid < (1<<24) &&
  3151. X        dm >= 0 && dm < 256 && width < 256 && height < 256 &&
  3152. X        hoff >= -128 && hoff < 128 && voff >= -128 && voff < 128) {
  3153. X        putc(flag | ((pk_len + 8) >> 8), pk_file);
  3154. X        putc(pk_len + 8, pk_file);
  3155. X        putc(cc, pk_file);
  3156. X        putmed(tfm_wid);
  3157. X        putc(dm, pk_file);
  3158. X        putc(width, pk_file);
  3159. X        putc(height, pk_file);
  3160. X        putc(hoff, pk_file);
  3161. X        putc(voff, pk_file);
  3162. X    } else
  3163. X    if (pk_len + 13 < 3 * 65536L && tfm_wid < (1<<24) &&
  3164. X        dm >= 0 && dm < 65536L && width < 65536L && height < 65536L &&
  3165. X        hoff >= -65536L && hoff < 65536L &&
  3166. X        voff >= -65536L && voff < 65536L) {
  3167. X        putc(flag | 4 | ((pk_len + 13) >> 16), pk_file);
  3168. X        putshort(pk_len + 13);
  3169. X        putc(cc, pk_file);
  3170. X        putmed(tfm_wid);
  3171. X        putshort(dm);
  3172. X        putshort(width);
  3173. X        putshort(height);
  3174. X        putshort(hoff);
  3175. X        putshort(voff);
  3176. X    }
  3177. X    else {
  3178. X        putc(flag | 7, pk_file);
  3179. X        putlong(pk_len + 28);
  3180. X        putlong(cc);
  3181. X        putlong(tfm_wid);
  3182. X        putlong((long) (char_width * 65536.0 + 0.5) - (char_width < -0.5));
  3183. X        putlong(0);
  3184. X        putlong(width);
  3185. X        putlong(height);
  3186. X        putlong(hoff);
  3187. X        putlong(voff);
  3188. X    }
  3189. X    fwrite(bitmap, 1, pk_len, pk_file);
  3190. X    if (!quiet) {
  3191. X        putchar(']');
  3192. X        fflush(stdout);
  3193. X    }
  3194. }
  3195. X
  3196. int
  3197. main(int argc, char **argv)
  3198. {
  3199. X    FILE    *config_file;
  3200. X    FILE    *tfm_file;
  3201. X    float    dpi;
  3202. X    char    *fontname;
  3203. X    int    fontlen;
  3204. X    char    *configline;
  3205. X    unsigned int    cflinelen;
  3206. X    char    *p;
  3207. X    char    *PSname        = NULL;
  3208. X    char    *specinfo    = "";
  3209. X    char    *xfilename;
  3210. X    char    charlist[10*2 + 90*3 + 156*4 + 1];
  3211. X    char    designstr[20];
  3212. X    char    dpistr[20];
  3213. X    int    pid;
  3214. X    int    std_in[2];
  3215. X    int    std_out[2];
  3216. X    int    status;
  3217. X    int    cc;
  3218. X    int    ppp;
  3219. X    int    i;
  3220. X
  3221. X        kpse_set_progname(argv[0]);
  3222. X        kpse_init_prog("GSFTOPK", 300, "cx", false, "cmr10");
  3223. X        xputenv_int ("KPATHSEA_DPI", 300);
  3224. X
  3225. X    if (strcmp(argv[1], "-q") == 0) {
  3226. X        ++argv;
  3227. X        --argc;
  3228. X        quiet = True;
  3229. X    }
  3230. X
  3231. X    if (argc != 3 || (dpi = atof(argv[2])) <= 0.0) {
  3232. X        fputs("Usage: gsftopk [-q] <font> <dpi>\n", stderr);
  3233. X        exit(1);
  3234. X    }
  3235. X    fontname = argv[1];
  3236. X    fontlen = strlen(fontname);
  3237. X
  3238. X    if (!quiet) puts(ident);
  3239. X
  3240. X    config_file = fopen(kpse_find_file ("psfonts.map", kpse_dvips_config_format, false), "r");
  3241. X    if (config_file == NULL) oops("Cannot find file psfonts.map.");
  3242. X
  3243. X    configline = (char *) xmalloc(cflinelen = 80, "Config file line");
  3244. X    do {
  3245. X        int len    = 0;
  3246. X
  3247. X        if (fgets(configline, cflinelen, config_file) == NULL)
  3248. X        oops("Cannot find font %s in config file.", fontname);
  3249. X        for (;;) {
  3250. X        i = strlen(configline + len);
  3251. X
  3252. X        len += i;
  3253. X        if (len > 0 && configline[len - 1] == '\n') {
  3254. X            configline[--len] = '\0';
  3255. X            break;
  3256. X        }
  3257. X        if (len < cflinelen - 1) break;
  3258. X        configline = xrealloc(configline, cflinelen += 80,
  3259. X            "config file line");
  3260. X        fgets(configline + len, cflinelen - len, config_file);
  3261. X        }
  3262. X    }
  3263. X    while (memcmp(configline, fontname, fontlen) != 0
  3264. X        || (configline[fontlen] != '\0' && !isspace(configline[fontlen])));
  3265. X    fclose(config_file);
  3266. X
  3267. X    /*
  3268. X     * Parse the line from the config file.
  3269. X     */
  3270. X    for (p = configline + fontlen; *p != '\0'; ++p) {
  3271. X        if (isspace(*p)) continue;
  3272. X        if (*p == '<') {
  3273. X        char    *q    = ++p;
  3274. X        char    endc;
  3275. X        FILE    *f;
  3276. X
  3277. X        addtodls(" (");
  3278. X        while (*p != '\0' && !isspace(*p)) ++p;
  3279. X        endc = *p;
  3280. X        *p = '\0';
  3281. X        strcpy(searchpath, kpse_find_file(q, kpse_dvips_header_format, true));
  3282. X        f = fopen(searchpath, "r");
  3283. X        if (f == NULL) oops("Cannot find font file %s", q);
  3284. X        /* search() also sets searchpath */
  3285. X        addtodls(searchpath);
  3286. X        addtodls((char) getc(f) == '\200' ? ") brun" : ") run");
  3287. X        fclose(f);
  3288. X        if (endc == '\0') break;
  3289. X        continue;
  3290. X        }
  3291. X        else if (*p == '"') {
  3292. X        char    *q;
  3293. X
  3294. X        specinfo = ++p;
  3295. X        q = strchr(p, '"');
  3296. X        if (q == NULL) break;
  3297. X        p = q;
  3298. X        }
  3299. X        else {
  3300. X        PSname = p;
  3301. X        while (*p != '\0' && !isspace(*p)) ++p;
  3302. X        if (*p == '\0') break;
  3303. X        }
  3304. X        *p = '\0';
  3305. X    }
  3306. X
  3307. X    /*
  3308. X     *    Start up GhostScript.
  3309. X     */
  3310. X
  3311. X    strcpy(searchpath, kpse_find_file("render.ps", kpse_dvips_header_format, true));
  3312. X    tfm_file = fopen(searchpath, "r");
  3313. X    if (tfm_file == NULL)
  3314. X        oops("Cannot find PS driver file \"render.ps\".");
  3315. X    fclose(tfm_file);
  3316. X
  3317. X    sprintf(dpistr, "%f", dpi);
  3318. X
  3319. X    if (pipe(std_in) != 0 || pipe(std_out) != 0) {
  3320. X        perror("pipe");
  3321. X        return 1;
  3322. X    }
  3323. X
  3324. X    fflush(stderr);        /* to avoid double flushing */
  3325. X    pid = vfork();
  3326. X    if (pid == 0) {
  3327. X        close(std_in[1]);
  3328. X        dup2(std_in[0], 0);
  3329. X        close(std_in[0]);
  3330. X        close(std_out[0]);
  3331. X        dup2(std_out[1], 1);
  3332. X        close(std_out[1]);
  3333. X        execlp(GS, "gs", "-DNODISPLAY", "-q", "--",
  3334. X        /* render.ps */ searchpath,
  3335. X        PSname != NULL ? PSname : fontname,
  3336. X        dlstring != NULL ? dlstring : "", specinfo, dpistr, NULL);
  3337. X        perror("gs");
  3338. X        exit(1);
  3339. X    }
  3340. X    if (pid == -1) {
  3341. X        perror("fork");
  3342. X        exit(1);
  3343. X    }
  3344. X
  3345. X    /*
  3346. X     *    Open and read the tfm file.  If this takes a while, at least
  3347. X     *    it can overlap with the startup of GhostScript.
  3348. X     */
  3349. X
  3350. X    fontlen = strlen(fontname);
  3351. X    xfilename = xmalloc(fontlen + 10, "name of tfm/pk file");
  3352. X    strcpy(xfilename, fontname);
  3353. X    /* strcpy(xfilename + fontlen, ".tfm"); */
  3354. X    strcpy(searchpath, kpse_find_file(xfilename, kpse_tfm_format, true));
  3355. X    tfm_file = fopen(searchpath, "r");
  3356. X    if (tfm_file == NULL) oops("Cannot find tfm file.");
  3357. X    for (i = 0; i < 12; ++i) {
  3358. X        int j;
  3359. X
  3360. X        j = (int) ((byte) getc(tfm_file)) << 8;
  3361. X        tfm_lengths[i] = j | (int) ((byte) getc(tfm_file));
  3362. X    }
  3363. X    checksum = getlong(tfm_file);
  3364. X    design = getlong(tfm_file);
  3365. X    fseek(tfm_file, 4 * (lh + 6), 0);
  3366. X    p = charlist;
  3367. X    for (cc = bc; cc <= ec; ++cc) {
  3368. X        width_index[cc] = (byte) getc(tfm_file);
  3369. X        if (width_index[cc] != 0) {
  3370. X        sprintf(p, "%d ", cc);
  3371. X        p += strlen(p);
  3372. X        }
  3373. X        (void) getc(tfm_file);
  3374. X        (void) getc(tfm_file);
  3375. X        (void) getc(tfm_file);
  3376. X    }
  3377. X    for (i = 0; i < nw; ++i) tfm_widths[i] = getlong(tfm_file);
  3378. X    fclose(tfm_file);
  3379. X    p[-1] = '\n';
  3380. X
  3381. X    /* write the design size and character list to the file */
  3382. X    sprintf(designstr, "%f\n", (float) design / (1 << 20));
  3383. X    write(std_in[1], designstr, strlen(designstr));
  3384. X    write(std_in[1], charlist, p - charlist);
  3385. X    close(std_in[1]);
  3386. X
  3387. /*
  3388. X *    Read the output from GhostScript.
  3389. X */
  3390. X
  3391. X    if ((data_file = fdopen(std_out[0], "r")) == NULL) {
  3392. X        perror("GS_out");
  3393. X        exit(1);
  3394. X    }
  3395. X
  3396. /*
  3397. X *    Create pk file and write preamble.
  3398. X */
  3399. X
  3400. X    fflush(stdout);
  3401. X    sprintf(xfilename + fontlen, ".%dpk", (int) (dpi + 0.5));
  3402. X    if ((pk_file = fopen(xfilename, "w")) == NULL) {
  3403. X        perror(xfilename);
  3404. X        exit(1);
  3405. X    }
  3406. X    putc(PK_PRE, pk_file);
  3407. X    putc(PK_ID, pk_file);
  3408. X    i = strlen(ident);
  3409. X    putc(i, pk_file);
  3410. X    fwrite(ident, 1, i, pk_file);
  3411. X    putlong(design);
  3412. X    putlong(checksum);
  3413. X    ppp = dpi / 72.27 * 65536.0 + 0.5;
  3414. X    putlong(ppp);    /* hppp */
  3415. X    putlong(ppp);    /* vppp */
  3416. X
  3417. /*
  3418. X *    Write the actual characters.
  3419. X */
  3420. X
  3421. X    for (cc = bc; cc <= ec; ++cc)
  3422. X        if (width_index[cc] != 0)
  3423. X        putglyph(cc);
  3424. X    fclose(data_file);
  3425. X
  3426. X    if (wait(&status) == -1) {
  3427. X        perror("wait");
  3428. X        exit(1);
  3429. X    }
  3430. X    if (status != 0)
  3431. X        if (status & 0377)
  3432. X        oops("Call to gs stopped by signal %d", status & 0177);
  3433. X        else oops("Call to gs returned nonzero status %d", status >> 8);
  3434. X
  3435. X    putc(PK_POST, pk_file);
  3436. X    while (ftell(pk_file) % 4 != 0) putc(PK_NOP, pk_file);
  3437. X    fclose(pk_file);
  3438. X    if (!quiet) putchar('\n');
  3439. X    return 0;
  3440. }
  3441. SHAR_EOF
  3442.   $shar_touch -am 1215233994 'gsftopk/gsftopk.c' &&
  3443.   chmod 0644 'gsftopk/gsftopk.c' ||
  3444.   echo 'restore of gsftopk/gsftopk.c failed'
  3445.   shar_count="`wc -c < 'gsftopk/gsftopk.c'`"
  3446.   test 23315 -eq "$shar_count" ||
  3447.     echo "gsftopk/gsftopk.c: original size 23315, current size $shar_count"
  3448. fi
  3449. # ============= gsftopk/render.ps ==============
  3450. if test -f 'gsftopk/render.ps' && test X"$1" != X"-c"; then
  3451.   echo 'x - skipping gsftopk/render.ps (file already exists)'
  3452. else
  3453.   echo 'x - extracting gsftopk/render.ps (text)'
  3454.   sed 's/^X//' << 'SHAR_EOF' > 'gsftopk/render.ps' &&
  3455. % render.ps - write font bitmaps and metric information to standard output.
  3456. % Version 1.6.
  3457. X
  3458. % Copyright (c) 1994 Paul Vojta.  All rights reserved.
  3459. %
  3460. % Redistribution and use in source and binary forms, with or without
  3461. % modification, are permitted provided that the following conditions
  3462. % are met:
  3463. % 1. Redistributions of source code must retain the above copyright
  3464. %    notice, this list of conditions and the following disclaimer.
  3465. % 2. Redistributions in binary form must reproduce the above copyright
  3466. %    notice, this list of conditions and the following disclaimer in the
  3467. %    documentation and/or other materials provided with the distribution.
  3468. %
  3469. % THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  3470. % ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  3471. % IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  3472. % ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  3473. % FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3474. % DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  3475. % OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  3476. % HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  3477. % LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  3478. % OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  3479. % SUCH DAMAGE.
  3480. X
  3481. %%%
  3482. % Usage:  gs -DNODISPLAY -q -- render.ps fontname dlstring specinfo dpi
  3483. % Then, it will read standard input to get:
  3484. %    pointsize
  3485. %    charset
  3486. X
  3487. % Example:
  3488. % % gs -DNODISPLAY -q -- render.ps Helvetica "(phvr.gsf) run" \
  3489. % > ".5 ExtendFont" 300
  3490. % GS> 10
  3491. % GS> 97 98 99
  3492. X
  3493. X
  3494. %%
  3495. %
  3496. % Define some routines first
  3497. X
  3498. % (string) fatal -
  3499. %    Print string to stderr and quit.
  3500. X
  3501. /fatal
  3502. X  {
  3503. X    (render.ps: ) exch concatstrings
  3504. X    .stderr exch writestring .stderr flushfile 1 .quit
  3505. X  }
  3506. bind def
  3507. X
  3508. % (exec) getbbox -
  3509. %    Get bounding box of the executable object.
  3510. %    It also makes a device just a few pixels larger on each side.
  3511. X
  3512. /getbbox
  3513. X  {
  3514. X    gsave
  3515. X      nulldevice
  3516. X      erasepage
  3517. X      newpath
  3518. X      exec
  3519. X      pathbbox % returns llx lly urx ury
  3520. X      /char-ury exch ceiling cvi def
  3521. X      /char-urx exch ceiling cvi def
  3522. X      /char-lly exch floor cvi def
  3523. X      /char-llx exch floor cvi def
  3524. X    grestore
  3525. X
  3526. X      matrix
  3527. X      char-urx char-llx sub 4 add % width
  3528. X      char-ury char-lly sub 4 add % height
  3529. X      <ff 00>
  3530. X    makeimagedevice setdevice
  3531. X    2 char-llx sub 2 char-lly sub translate
  3532. X  }
  3533. bind def
  3534. X
  3535. %%
  3536. %
  3537. % These may be called by the "specinfo" string.
  3538. X
  3539. /usefontbbox false def
  3540. X
  3541. % These do things to a transformation array; called by entries in psfonts.map.
  3542. %
  3543. /ObliqueSlant { dup sin exch cos div neg } bind def
  3544. /SlantFont { font-size mul add } def
  3545. /ExtendFont { 3 -1 roll mul exch } def
  3546. /ReEncodeFont { TargetFont dup length dict /newdict exch def
  3547. X  {1 index /FID ne {newdict 3 1 roll put} {pop pop} ifelse} forall
  3548. X  newdict exch /Encoding exch put
  3549. X  /OurFont newdict definefont /TargetFont exch def} def
  3550. X
  3551. X
  3552. %%
  3553. %
  3554. % Main program begins now.  Just interpret it.
  3555. X
  3556. % Get arguments.
  3557. X
  3558. shellarguments not
  3559. X  {
  3560. X    (You must provide arguments to the shell!\n) fatal
  3561. X  }
  3562. if
  3563. X
  3564. /dpi exch cvr def
  3565. /specinfo exch def
  3566. /dlstring exch def
  3567. /fontname exch def
  3568. X
  3569. % Open the font.
  3570. X
  3571. dlstring () ne
  3572. X  {
  3573. X    dlstring cvx exec
  3574. X    Fontmap fontname cvn known
  3575. X    FontDirectory fontname cvn known or
  3576. X  }
  3577. X  {
  3578. X    Fontmap fontname cvn known
  3579. X  }
  3580. ifelse
  3581. X
  3582. not
  3583. X  {
  3584. X    (font ) fontname concatstrings ( is not defined.\n) concatstrings
  3585. X    fatal
  3586. X  }
  3587. if
  3588. X
  3589. % Get arguments from stdin.  Just leave the character list on the stack.
  3590. X
  3591. /font-size
  3592. X  .stdin 20 string readline pop cvr % get pointsize
  3593. X  72.27 div dpi mul % let's work in (TeX) points
  3594. def
  3595. [ .stdin 1024 string readline pop cvx exec ] % character list
  3596. X
  3597. % Define the font, and make it current.
  3598. X
  3599. /TargetFont fontname cvlit findfont def
  3600. X  TargetFont
  3601. X  [ font-size 0 specinfo cvx exec 0 exch font-size 0 0 ]
  3602. makefont setfont
  3603. X
  3604. % If the font's bounding box is zero, then do not use it.
  3605. X
  3606. usefontbbox
  3607. X  { currentfont /FontBBox get
  3608. X    true exch {0 eq and} forall
  3609. X    {/usefontbbox false def}if
  3610. X  }
  3611. if
  3612. X
  3613. % If we are to use the font's bounding box, then get it and transform it.
  3614. X
  3615. usefontbbox
  3616. X  {
  3617. X    { currentfont /FontBBox get
  3618. X      dup dup 0 get exch 1 get currentfont /FontMatrix get transform moveto
  3619. X      dup dup 0 get exch 3 get currentfont /FontMatrix get transform lineto
  3620. X      dup dup 2 get exch 1 get currentfont /FontMatrix get transform lineto
  3621. X      dup     2 get exch 3 get currentfont /FontMatrix get transform lineto
  3622. X    }
  3623. X    getbbox
  3624. X  }
  3625. if
  3626. X
  3627. % Begin loop over characters.
  3628. X
  3629. X  {
  3630. X    /charno exch def
  3631. X    /charstring 1 string dup 0 charno put def
  3632. X    /charwidth charstring stringwidth pop def
  3633. X
  3634. X    % Get the character's bounding box.  This also makes the device.
  3635. X    usefontbbox not
  3636. X      {
  3637. X        { 0 0 moveto charstring true charpath } getbbox
  3638. X      }
  3639. X    if
  3640. X
  3641. X    % Print the metric info.
  3642. X    (#^ ) print
  3643. X    charno =string cvs print
  3644. X    ( ) print
  3645. X    char-llx =string cvs print
  3646. X    ( ) print
  3647. X    char-lly =string cvs print
  3648. X    ( ) print
  3649. X    char-urx =string cvs print
  3650. X    ( ) print
  3651. X    char-ury =string cvs print
  3652. X    ( ) print
  3653. X    charwidth =string cvs print
  3654. X    (\n) print
  3655. X
  3656. X    % Now write the bitmap.
  3657. X    erasepage 0 0 moveto
  3658. X    charstring show
  3659. X    .stdout currentdevice writeppmfile
  3660. X  }
  3661. forall
  3662. SHAR_EOF
  3663.   $shar_touch -am 0515192194 'gsftopk/render.ps' &&
  3664.   chmod 0644 'gsftopk/render.ps' ||
  3665.   echo 'restore of gsftopk/render.ps failed'
  3666.   shar_count="`wc -c < 'gsftopk/render.ps'`"
  3667.   test 5319 -eq "$shar_count" ||
  3668.     echo "gsftopk/render.ps: original size 5319, current size $shar_count"
  3669. fi
  3670. exit 0
  3671.